STL学习小结之string

一、使用时需添加头文件#include<string>

二、在string对象尾部追加字符串

    

三、删除string对象

1.如果要清空string对象,直接赋值为空就行。

2.用erase()方法删除迭代器所指的区间内的元素。

四、length()方法返回string对象的长度。 

五、替换string对象的字符

    

六、搜索string对象中的内容。

 


猜你喜欢

转载自blog.csdn.net/adusts/article/details/80170868