#include <string>
#include <cctype>
#include <algorithm>
#include <iostream>
#include <list>
using namespace std;
class Base{
public:
int data;
Base(int y):data(y){}
};
Base *pt(int x){
Base *tmp = new Base(x);
return tmp;
}
int main()
{
string str("this is a test");
char rpV = '^';
string::size_type pos = ;
while((pos = str.find(" ")) != string::npos){
//replace(pos, nct1, nct2, ch); 用重复n次的c字符替换从指定位置pos长度为len的内容
str.replace(pos,,, rpV);
cout << str << endl;
}
}
相关文章
- 08-22151. Reverse Words in a String
- 08-22LeetCode 151:给定一个字符串,逐个翻转字符串中的每个单词 Reverse Words in a String
- 08-22LeetCode-151-Reverse Words in s String
- 08-22LeetCode 151. Reverse Words in a String
- 08-22字符串(string)方法与对象
- 08-22substr,subString,split,slice,replace的区别
- 08-22字符的替换/切片/分割/组合 replace_slice_splite_join 的使用
- 08-22js String
- 08-22StringBuffer StringBuilder String 区别
- 08-22string和stringbuffer stringbuilder的快速理解。