string& erase (size_t pos = 0, size_t len = npos); //如果是int类型的话,str.erase(pos)是从pos位置开始删除到最后,因为默认len=pos,等于字符串的长度.
character (2)
iterator erase (const_iterator p);//注意类型,const_iterator 类型时是删除指定的位置.
C++的string
转载string中find()返回值是字母在母串中的位置(下标记录),如果没有找到,返回npos。
string的substr(pos=0, count=npos)返回字符串[pos, pos+count)
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:C++的函数功能总结
下一篇:C++中为何大量使用类指针
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
C++ String
C++ String
c++ 开发语言 后端 字符串 ci -
C++ string 操作
#include #include ...
字符串 子串 指定位置 #include ios