如题所述
ä½¿ç¨ string ç find æåå½æ°ã
#include <string>
using namespace std;
int main()
{
string str = "afdsdfs_hello_sdfas#@!";
string str1 = "hello";
string::size_type idx = str.find( str1 );
if ( idx != string::npos )
{
cout << "å符串å«æâ<< str1 << "\n";
}
else
{
cout << "å符串没æ" << str1 << "\n";
}
}
温馨提示:答案为网友推荐,仅供参考