首页 > 编程语言 > 详细

C++ string的那些坑

时间:2015-02-05 21:48:57      阅读:317      评论:0      收藏:0      [点我收藏+]

1. size_type find_first_of( const basic_string &str, size_type index = 0 ); 

查找在字符串中第一个与str中的某个字符匹配的字符,返回它的位置。搜索从index开始,如果没找到就返回string::npos

2. string& replace (size_t pos, size_t len, const string& str);

从当前字符串的pos位置开始,长度为len的段落,替换成成str

3. int compare (const string& str) 

结果为0,表示字符串相等,等价于字符串间的=

C++ string的那些坑

原文:http://www.cnblogs.com/guoxiaoqian/p/4275959.html

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