📅  最后修改于: 2020-09-25 09:15:15             🧑  作者: Mango
size_t strspn( const char* dest, const char* src );
它在
strspn()
函数返回dest
的最大初始段的长度,该段仅包含src
指向的字节字符串的 字符 。
#include
#include
using namespace std;
int main()
{
char src[] = "0123456789";
char dest[] = "190126abqs121kfew";
size_t length = strspn(dest, src);
cout << dest << " contains " << length << " initial numbers";
return 0;
}
运行该程序时,输出为:
190126abqs121kfew contains 6 initial numbers