string insert()函数的用法
来源:互联网 发布:ppt图表无法修改数据 编辑:程序博客网 时间:2024/06/05 00:13
#include <iostream>#include <string>int main (){ std::string str="to be question"; std::string str2="the "; std::string str3="or not to be"; std::string::iterator it; // used in the same order as described above: str.insert(6,str2); // to be (the )question str.insert(6,str3,3,4); // to be (not )the question str.insert(10,"that is cool",8); // to be not (that is )the question str.insert(10,"to be "); // to be not (to be )that is the question str.insert(15,1,':'); //加一个'.' to be not to be(:) that is the question it = str.insert(str.begin()+5,','); // to be(,) not to be: that is the question str.insert (str.end(),3,'.'); // to be, not to be: that is the question(...) str.insert (it+2,str3.begin(),str3.begin()+3); // (or ) std::cout << str << '\n'; return 0;}//output to be, or not to be: that is the question...
毕竟官方用例,hin nice
link:
http://www.cplusplus.com/reference/string/string/insert/
0 0
- string insert()函数的用法
- string的函数用法
- 执行Insert语句时使用string的Format用法
- string类中insert,find,copy的用法
- string.Format函数的用法
- string的append函数用法
- String一些函数的用法
- string.format()函数的用法
- string的append函数用法
- C++ string类insert函数
- 在XSLT中 Transalate(string,string,string) 函数的用法
- ECSHOP中INSERT函数的定义及用法
- C++ list中insert、erase和remove函数的用法
- Bulk Insert的用法
- Bulk Insert的用法
- Bulk Insert的用法
- INSERT ALL的用法
- Bulk Insert的用法
- MyISAM 和InnoDB
- (GIS可视化)热点分析原理及实现
- (转-原作者不详)-浅析JavaScript访问对象属性和方法及区别
- poj 2299 树状数组(离散化)求逆序数
- 数据流重定向-导出训练日志
- string insert()函数的用法
- hdu 2319
- 判断文件是否为二进制
- numpy找出array中的最大值,最小值
- Hibernate 未联网情况下不能根据dtd解析hbm.xml
- F
- SpringBoot 学习记录(十): scheduler
- 第七届 山东省ACM Proxy(SPFA+反向建边)
- strcat标准库函数