string replace

#include <iostream>
#include <string.h>
using namespace std;
int main()
{
 string result;
 string s ( "AAAAAAAA" );
 char ch = 'C';
 result = s.replace ( 1 , 3 , 4 , ch ); // s= "ACCCCAAAA
 cout<<s<<endl;
 return 0;
}
原文地址:https://www.cnblogs.com/byfei/p/3112261.html