string的find和find_first_of的区别
来源:互联网 发布:js将html转化为纯文本 编辑:程序博客网 时间:2024/05/08 23:44
今天遇到个bug,原来是在查找子串时调用了find_first_of,导致字符串替换出现问题。
现将find和find_first_of的区别与几种使用形式介绍如下
find是查找子串,而find_first_of类似于模式匹配,只要与其中的一个字符匹配就行。
find有四种使用形式。
1、size_type find(const basic_string& str, size_type pos = 0) const;
表示 从pos位置开始找子字符串str
2、size_type find(const char* s, size_type pos, size_type count)const;
从pos位置开始找到与字符串s的前count个字符相等的子串
3、size_type find(const char* s, size_type pos = 0)const;
从pos位置开始找与字符串s相等的子串
4、size_type find(char ch, size_type pos = 0) const;
从pos位置开始找字符ch。
find_first_of的四种形式
1、size_type find_first_of(const basic_string& str, size_type pos = 0)const;
从pos位置开始找到第一个与str中任意一个字符相等的字符
2、size_type find_first_of(const char*s, size_type pos, size_type count)const;
从pos位置开始找到第一个与str的前count中的任意一个字符相等的字符
3、size_type find_first_of(const char* s, size_type pos = 0)const;
从pos位置开始找到第一个与s中的任意一个字符相等的字符
4、size_type find_first_of(char ch, size_type pos = 0)const;
从pos位置开始找到第一个等于ch的字符。
- string的find和find_first_of的区别
- string的find和find_first_of的区别
- find()、find_end()、find_first_of()、find_if()的使用示例和区别
- C++string中的查找函数find与find_first_of函数的区别
- string中的find(),find_first_of(),find_first_not_of()之间区别
- string 类成员函数 find() / find_first_of() / find_last_of() 的用法详解
- C++ string类:find()和find_first_of()
- string类型中find和find_first_of
- find find_first_of区别
- stl string的substr和find_first_of函数的一点心得
- find ,find_first_of , find_if , adjacent_find的使用
- string类中find(),find_first_of()和find_first_not_of()函数
- C++--string--find_first_of() 和 find_last_of(),find()与npos
- string中find和find_first_of函数用法总结
- string 中的 find()、 find_first_of()、find_first_not_of()
- string 搜索功能 find find_first_of
- C++基础---string类的find/find_first_of/find_first_not_of/rfind/find_last_of/find_last_not_of
- STL可能的误用-find_first_of和erase
- csdn第一天
- Maven学习(九)- 构建SSH项目
- listview的使用----BaseAdapter
- Maven学习总结(十一)——Maven项目对象模型pom.xml文件详解
- 数据绑定(data binding)3
- string的find和find_first_of的区别
- boost::thread
- Maven学习(十) - 阶段小结
- SVN操作
- linux下vi命令的使用
- 简单排序:直接插入排序
- Hadoop系列一:Hadoop CDH4 编译安装介绍
- javascript闭包(Closure)初探
- Drozer安装使用及报错解决办法