#include <iostream>
#include<cmath>
#include<string>
using namespace std;
int main()
{
string s("noon is 12 pm; midnight is not.");
cout<<s.find("is")<<endl;
cout<<s.rfind("is")<<endl;
cout<<s.find_first_of("misop")<<endl;
cout<<s.find_last_of("misop")<<endl;
cout<<s.find_first_of(" ")<<endl;
cout<<s.find_first_not_of("noon is 12 pm; midnight is not.")<<endl;
cout<<string::npos<<endl;;
return 0;
}
string::npos为啥不是-1
猜你喜欢
转载自blog.csdn.net/natures66/article/details/88391438
今日推荐
周排行