【c++】C++中erase的用法

erase一共三种用法:
1.erase(pos,n);
删除从下标pos开始的n个字符,比如erase(0,1)就是删除第一个字符
2.erase(position);
删除postion处的一个字符(position是一个string类型的迭代器)
3.erase(first,last)
删除从first到last之间的字符(first和last都是迭代器)

posted @ 2021-08-06 14:51  opensmarty  阅读(1865)  评论(0编辑  收藏  举报