[C++] 数据查找 string.find(),string.find_first_of()与string::npos函数
string.find( )函数
判断 “abcdef” 中是否包含 “bcd”,使用如下语句:
string a = "abcdef";
string b = "bcad";
string::size_type pos = a.find(b); //定义一个标志
if (pos != string::npos)
{
std::cout<<"Yes"<<endl;
}
e...
原创
2018-09-30 15:31:59 ·
1058 阅读 ·
0 评论