vector<string>strs;
vector<string>::iterator itr;
string s1="this is test";
string s2="this";
string s3="is";
strs.push_back(s1);
strs.push_back(s2);
strs.push_back(s3);
itr=find(strs.begin(),strs.end(),"a test");
if(!(strs.end()==itr))
{
cout<<*itr<<endl;
}
//字符串中找单个字母
char*buf="this is test";
char*found=find(buf,buf+12,'s'); //12是串长度
if(found<buf+12)
{
cout<<*found<<endl;
}
else
cout<<"not found"<<endl;
//字符串找子串
size_t ok=s1.find(s2);
if(ok!=-1)
{
cout<<"ok:"<<ok<<endl;
string subs2=s1.substr(ok,s2.size());
}
else
cout<<"none"<<endl;