首页 > 编程语言 > 详细

C++ 关于字符串总结(持续更新)

时间:2015-05-22 00:04:38      阅读:241      评论:0      收藏:0      [点我收藏+]

1.find_first_of

size_type find_first_of( const basic_string &str, size_type index = 0 ); 
size_type find_first_of( const char *str, size_type index = 0 ); 
size_type find_first_of( const char *str, size_type index, size_type num ); 
size_type find_first_of( char ch, size_type index = 0 ); 

查找在字符串中第一个与str中的某个字符匹配的字符,返回它的位置。搜索从index开始,如果没找到就返回string::npos 注:npos表示size_t的最大值 
查找在字符串中第一个与str中的某个字符匹配的字符,返回它的位置。搜索从index开始,最多搜索num个字符。如果没找到就返回string::npos, 
查找在字符串中第一个与ch匹配的字符,返回它的位置。搜索从index开始。

2.std::string line  line.erase(pos,num); 删除字符串中的从pos位置开始的num个字符

C++ 关于字符串总结(持续更新)

原文:http://www.cnblogs.com/zhaoheng/p/4520935.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!