函数原型:
string&insert(int pos,const char*s);//插入字符串
string&insert(int pos,const string&str);//插入字符串
string&insert(int pos,int n;char c);//在指定位置插入n个字符
string&erase(int pos,int n=pos);//删除从pos开始的n个字符
#include<iostream>
using namespace std;
#include<string>
void test01()
{
string str1 = "hello";
str1.insert(1, "ppp");
cout << str1 << endl;
str1.insert(1,3,'r');
cout << str1 << endl;
str1.erase(0, 4);
cout << str1 << endl;
}
int main()
{
test01();
system("pause");
return 0;
}