c++ primer笔记之string
2008-07-22 16:57
274 查看
string 类提供了一套查找函数都以find 的各种变化形式命名find()是最简单的实例
给出一个字符串它返回匹配子串的第一个字符的索引位置或者返回一个特定的值
string::npos
msdn的解释如下“An unsigned integral value initialized to –1 that indicates either "not found" or "all remaining characters" when a search function fails.”
find_first_not_of()查找第一个不与要搜索字符串的任意字符相匹配的字符例如为找
到第一个非数字字符可以写
string elems( "0123456789" );
string dept_code( "03714p3" );
// returns index to the character 'p'
string::size_type pos = dept_code.find_first_not_of(elems);
find_last_of()查找字符串中的与搜索字符串任意元素相匹配 的最后一个字符
find_last_not_of()查找字符串中的与搜索字符串任
相关文章推荐
- C++ Primer 学习笔记——顺序容器的string操作
- c++ primer笔记之容器
- c++学习笔记--C++Primer第4版--标准库类型string
- C++ Primer 学习笔记(1)——迭代器,数组
- C++ Primer 学习笔记系列1
- 今日学习笔记:c# extern 关键字 和 kernel32.dll中的api:WritePrivateProfileString,GetPrivateProfileString
- C++ Template学习笔记之函数模板(1)——函数模板定义
- C++ Template学习笔记之函数模板(4)——显式模板实参
- C++ Primer Plus 笔记001
- 【Java学习笔记】解惑:string类型变量“不可变”?
- redis学习笔记3,String类型
- java笔记:第7章 String
- 黑马程序员--String基础学习笔记
- ios学习临时笔记-NSLocalizedString使用
- 2016/1/12 String 笔记整理
- C++学习之重回Primer笔记(开篇)
- Object-C 学习笔记(十四)---Foundation之NSMutableString
- 2012/1/9 《C++ Primer Plus》第三章:处理数据 学习笔记
- Java基础学习笔记(二)常用类String
- C++ Primer Plus 第六版 学习笔记 第七章 编程练习答案