C語言中 strpbrk()
函式 strpbrk() 用於查詢第一個字串的第一個字元,並將其與第二個字串的任意字元相匹配。 如果沒有找到匹配項,則返回 NULL,否則返回指向第一個字串的字元(與第二個字串的字元相匹配)的指標。
以下是 C 語言中 strpbrk() 的語法,
char *strpbrk(const char *string1, const char *string2)
以下是 C 語言中 strpbrk() 的一個示例,
示例
#include <stdio.h>
#include <string.h>
int main () {
const char s1[] = "Helloworld";
const char s2[] = "Blank";
char *result;
result = strpbrk(s1, s2);
printf("The matching character : %c
", *result);
return(0);
}輸出
The matching character : l
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C語言程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP