语法:
string& replace (size_t pos, size_t len, const string& str);
//str.replace(pos,len,str2);
使用方法:
replace函数第一个参数是pos(位置),作用为定义字符串替换初始下标。
第二个参数:替换字符串长度(len)。
第三个字符串指要替换的字符串(str2)。
#include<iostream>
#include<cmath>
using namespace std;
int main(){
string a="hollo world";
cout<<a<<endl;
a.replace(1,1,"e");
cout<<a;
return 0;
}