编程笔记 string的函数
来源:互联网 发布:珠峰js培训视频下载 编辑:程序博客网 时间:2024/06/06 14:21
C++ Primer Fifth Edition 英文彩色带书签 http://download.csdn.net/detail/kingeasternsun/5529053
C++ Primer Plus (6th Edition) 英文原版 彩色带书签http://download.csdn.net/detail/kingeasternsun/5508691
构造 string 对象的其他方法
string s(cp, n)
Create s as a copy of n characters from array pointed to bycp.
创建一个 string 对象,它被初始化为 cp 所指向数组的前 n 个元素的副本
string s(s2, pos2)
Create s as a copy of characters in the string s2 starting at indexpos2. Undefined ifpos2 > s2.size().
创建一个 string 对象,它被初始化为一个已存在的 string 对象 s2 中从下标 pos2 开始的字符的副本
string s(s2, pos2, len2)
Create s as a copy of len2 characters from s2 starting at index pos2. Undefined if pos2 > s2.size(). Regardless of the value oflen2, copies at mosts2.size() - pos2 characters.
创建一个 string 对象,它被初始化为 s2 中从下标 pos2 开始的 len2 个字符的副本。如果 pos2 > s2.size(),则该操作未定义,无论 len2 的值是多少,最多只能复制 s2.size() - pos2 个字符
Note: n, len2 and pos2 are all unsignedvalues.
注意:n、len2 和 pos2 都是 unsigned 值
string 类型特有的版本
s.insert(pos, n, c)
Insert n copies of character c before element at indexpos.
在下标为 pos 的元素之前插入 n 个字符 c
s.insert(pos, s2)
Insert copy of string s2 before pos.
在下标为 pos 的元素之前插入 string 对象 s2 的副本
s.insert(pos, s2, pos2, len)
Insert len characters from s2 starting at pos2 before pos.
在下标为 pos 的元素之前插入 s2 中从下标 pos2 开始的 len 个字符
s.insert(pos, cp, len)
Insert len characters from array pointed to by cp beforepos.
在下标为 pos 打元素之前插入 cp 所指向数组的前 len 个字符
s.insert(pos, cp)
Insert copy of null-terminated string pointed to by cp beforepos.
在下标为 pos 的元素之前插入 cp 所指向的以空字符结束的字符串副本
s.assign(s2)
Replace s by a copy of s2.
用 s2 的副本替换 s
s.assign(s2, pos2, len)
Replace s by a copy of len characters from s2 starting at index pos2 in s2.
用 s2 中从下标 pos2 开始的 len 个字符副本替换 s
s.assign(cp, len)
Replace s by len characters from array pointed to bycp.
用 cp 所指向数组的前 len 个字符副本替换 s
s.assign(cp)
Replace s by null-terminated array pointed to by cp.
用 cp 所指向的以空字符结束的字符串副本替换 s
s.erase(pos, len)
Erase len characters starting at pos.
删除从下标 pos 开始的 len 个字符
Unless noted otherwise, all operations return a reference tos.
除非特殊声明,上述所有操作都返回 s 的引用
- 编程笔记 string的函数
- 【ruby学习笔记】String的常用函数
- 自主编程实现String类的构造函数,析构函数,拷贝构造函数,赋值函数
- c++学习笔记---string中replace函数的使用
- javascript笔记:String类replace函数的一些事
- 【Lua学习笔记】 --> 《字符串string与table的函数操作》
- Lua string函数学习笔记
- C/C++学习笔记:String类的构造函数、析构函数和赋值函数
- 函数式编程笔记
- matlab函数编程笔记
- UNIX环境编程学习笔记------编程实例----域名解析函数的函数原型即getaddrinfo()函数原型
- string的几个函数
- String的一些函数
- string 的一些函数
- String的几个函数
- string的函数用法
- string 的构造函数
- string 的函数应用
- 日期格式化工具类DateFormat
- 超越Flat——iOS 7的救赎
- WM_COPYDATA Message
- 博客地址
- 伟大的程序员所必须具备的7项特质
- 编程笔记 string的函数
- self.nameVarPtr = [[ObjectName alloc] init] 和nameVarPtr = [[ObjectName alloc] init] 的区别
- 《念奴娇·赤壁怀古》苏轼
- 文件夹大小查看器
- spice server timer机制
- 程序设计和开发应注意的事项
- Xcode 4.2 enable Zombie
- linux 下利用vi操作文件相关
- Windows平台下动态链接库的总结