函数
C11标准链接:http://www.cplusplus.com/reference/string/string/find_first_of/?kw=string%3A%3Afind_first_of
C++中的定义
**
//string (1)size_t find_first_of (const string& str, size_t pos = 0) const noexcept;//c-string (2)size_t find_first_of (const char* s, size_t pos = 0) const;//buffer (3)size_t find_first_of (const char* s, size_t pos, size_t n) const;//character (4)size_t find_first_of (char c, size_t pos = 0) const noexcept;
功能
使用
string s("abcdABCD123");string::size_type position = s.find_first_of("123");
例子说明
# include<iostream># include<algorithm>using namespace std;int main(void){////find函数返回类型 size_typestring s("abcdABCD123");string::size_type position;//find 函数返回 AB 在 s 中的下标位置position = s.find_first_of("123");printf("s.find_first_of(\"123\") is :%d\n", position);}
