1.addpend和replace函数
附属代码
#include<iostream>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
string s("c++ Primer");
string s2 = s;
s.insert(s.size(), " 4th Ed."); //s.size()求字符串大小
s2.append(" 4th Ed."); //append == insert
cout << s << endl;
cout << s2 << endl;
s.erase(11, 3); //replace == erase + insert
s.insert(11, "5th");
s2.replace(11, 3, "5th");
cout << s << endl;
cout << s2 << endl;
}