函数原型:
#include
size_type find_first_not_of(const string &str,size_type index =0 )const;
size_type find_first_not_of(const Char* str,size_type index =0 )const;
size_type find_first_not_of(const Char* str,size_type index,size_type num )const;
size_type find_first_not_of(Char ch,size_type index =0 )const;
函数find_first_not_of()功能如下:
1.返回在字符串中首次出现的不匹配str任何字符的首字符索引, 从index开始搜索, 如果全部匹配则返回string::npos。
2.从index开始起搜索当前字符串, 查找其中与str前num个字符中的任意一个都不匹配的序列, 返回满足条件的第一个字符索引, 否则返回string::npos。
3.返回在当前字符串中第一个不匹配ch字符的索引, 从index开始搜索, 没用收获则返回string::npos。
注:string 类将 npos 定义为保证大于任何有效下标的值。npos = -1代表字符串索引号的末尾一个。或者表示无效索引号。表示没能查找到