
string c++详解
文章平均质量分 78
ffjbq
这个作者很懒,什么都没留下…
展开
-
string c++详解 find_first_not_of() find_first_of()
这两个方法都是查找与()中指定的字符串中任意一个字符都不相符的字符的位置地址,而不是返回的是与()中制定的字符串完全匹配的字符串的首地址 find_first_not_of()语法: size_type find_first_not_of( const basic_string &str, size_type index = 0 ); size_type f原创 2012-05-29 01:18:48 · 35853 阅读 · 2 评论 -
string c++ 详解 erase find
string& erase ( size_t pos = 0, size_t n = npos ); 删除字符串从位置pos(默认为0)的npos个字符。iterator erase ( iterator position ); 删除字符串从位置position开始之后的所有字符iterator erase ( iterator first, iterator last ); 删除字符串从原创 2012-05-29 00:52:05 · 1242 阅读 · 0 评论 -
string c++ 详解 6 compare
比较两个字符串是否相同,按照字典顺序分别输出为正int compare ( const string& str ) const; 比较字符串int compare ( const char* s ) const; 比较字符数组int compare ( size_t pos1, size_t n1, const string& str ) const; 比较str字串从位置pos1原创 2012-05-28 23:26:40 · 2741 阅读 · 0 评论 -
string c++详解 7 copy data empty end
copy size_t copy ( char* s, size_t n, size_t pos = 0) const;Copy sequence of characters from stringCopies a sequence of characters from the string content to the array pointed bys. This sequ原创 2012-05-29 00:14:05 · 453 阅读 · 0 评论 -
string c++ 详解 5 capacity size length max_size clear
size_t max_size ( ) const;Return maximum size of string返回string对象所能包含的最大字符数 size_t capacity ( ) const;Return size of allocated storage返回string对象再不用重新分配内存的情况下所能包含的最大字符数 size_t l原创 2012-05-28 23:02:09 · 795 阅读 · 0 评论 -
c++ string详解 c_str()
const char* c_str ( ) const;将c++标准std string类转换为标准c的string格式 char * 类型,并将首地址返回, 地址从[0]开始算。举例:string testcstr = "Hello World";const char *pch = testcstr.c_str();coutcout//打印结果为 Hello Worl原创 2012-05-28 22:21:55 · 2154 阅读 · 0 评论