string s1 = "Hello ";
string s2 = "World!";
s1.append(s2);
cout << s1 << endl;
string s3 = "Hello ";
string s4 = "Hello World!";
s3.append(s4,6,5);//从s4的第六位(0位开始数)开始的连续5位--World,即s3+"World"
cout << s3 << endl;//
string s5 = "Hello ";
//将10个A拼接到字符串s5的后面
s5.append(10,'A');
cout << s5 << endl;
string s6 = s1 + s2;
cout << s6 <<endl;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)