c++string类的查找操作

请问c++中find_first_of函数的具体的使用方法,尽量具体一些?

http://www.cplusplus.com/reference/string/string/

但凡有不会的STL就上着里面看吧,没有人会比这个说的更详细了。

http://blog.csdn.net/zhenyusoso/article/details/7286456
用于在字符串中查找子串

就是查找子字符串的第一个匹配位置,如果没找到就返回std::string::npos

// string::find_first_of
#include // std::cout
#include // std::string
#include // std::size_t

int main ()
{
std::string str ("Please, replace the vowels in this sentence by asterisks.");
std::size_t found = str.find_first_of("aeiou");
while (found!=std::string::npos)
{
str[found]='*';
found=str.find_first_of("aeiou",found+1);
}

std::cout << str << '\n';

return 0;
}

Edit & Run

Pl**s*, r*pl*c* th* v*w*ls n th*s s*nt*nc by *st*r*sks.

http://www.cplusplus.com/reference/string/string/