C++字符串拼接 字符串拼接
功能描述:
实现在字符串末尾拼接字符串
#include <iostream>
#include <string>
using namespace std;
void test01()
{
string str1 = "我";
str1 += "爱玩游戏";
cout << "str1 = " << str1 << endl;
str1 += ":";
cout << "str1 = " << str1 << endl;
string str2 = "LOL DNF";
str1 += str2;
cout << "str1 = " << str1 << endl;
string str3 = "I";
str3.append(" love ");
str3.append("game abcde", 4);
cout << "str3 = " << str3 << endl;
str3.append(str2, 4, 3);
cout << "str3 = " << str3 << endl;
}
int main()
{
test01();
return 0;
}
C++字符串拼接 字符串拼接
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)