C++ 提高教程 STL -String 字符串删除和存取

 

# include<iostream>
# include<string>
using namespace std;

void test01()
{
	string str1 = "Hello";
	cout << "str1:" << str1 << endl;
	str1.insert(1, "111");
	cout << "str1:" << str1 << endl;
	str1.erase(1, 3);
	cout << "str1:" << str1 << endl;
}
int main()
{
	test01();
	system("pause");
	return 0;
}
全部评论

相关推荐

头像 会员标识
12-16 14:18
浙江大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务