码迷,mamicode.com
首页 > 编程语言 > 详细

C++ string的那些坑

时间:2015-02-05 21:51:04      阅读:217      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!