📅  最后修改于: 2020-09-25 09:13:57             🧑  作者: Mango
const char* strpbrk( const char* dest, const char* breakset );
char* strpbrk( char* dest, const char* breakset );
strpbrk()
函数采用两个以null终止的字节字符串: dest
和breakset
作为其参数。它在dest
指向的空终止字节字符串搜索breakset
所指向的字符串存在的任何字符 ,并在dest
返回指向该字符的指针。
它在
#include
#include
using namespace std;
int main()
{
char digits[] = "0123456789";
char code[] = "ceQasieoLPqa4xz10Iyq";
char *pos;
int count = 0;
pos = strpbrk (code, digits);
while (pos != NULL)
{
pos = strpbrk (pos+1,digits);
count ++;
}
cout << "There are " << count << " numbers in " << code;
return 0;
}
运行该程序时,输出为:
There are 3 numbers in ceQasieoLPqa4xz10Iyq