size_t strcspn(const char* s1,const char* s2); //在字符串中s1找到与s2相同的第一个字符的位置
#include<iostream>
using namespace std;
int main()
{
const char* s = "asdfghjklasd";
int c=strlen(s);
size_t len = std::strcspn(s, "a");
cout << "After resizing, string value is : " << len <<" c: "<<c << "结束";
return 0;
}
运行结果: len ==0 c==12