Chinaunix首页 | 论坛 | 博客
  • 博客访问: 359779
  • 博文数量: 100
  • 博客积分: 2500
  • 博客等级: 大尉
  • 技术积分: 1209
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-15 21:24
文章分类

全部博文(100)

文章存档

2011年(100)

分类: C/C++

2011-04-21 14:59:29


  1. const char* c_str ( ) const;
  2. //Generates a null-terminated sequence of characters (c-string) with the same content as the string object and returns it as a pointer to an array of characters.
  1. const char* data() const;
  2. //Returns a pointer to an array of characters with the same content as the string.
  1. allocator<char> get_allocator( ) const;
  2. //Returns the allocator object used to constuct the object.
  1. size_t copy ( char* s, size_t n, size_t pos = 0) const;
  2. //Copies a sequence of characters from the string content to the array pointed by s. This sequence of characters is made of the characters in the string that start at character position pos and span n characters from there.

    The function does not append a null character after the content copied. To retrieve a temporary c-string value from a string object, a specific member function exists: .
  1. size_t find ( const string& str, size_t pos = 0 ) const;
  2. size_t find ( const char* s, size_t pos, size_t n ) const;
  3. size_t find ( const char* s, size_t pos = 0 ) const;
  4. size_t find ( char c, size_t pos = 0 ) const;
  5. //Searches the string for the content specified in either strs or c, and returns the position of the first occurrence in the string.
  1. size_t rfind ( const string& str, size_t pos = npos ) const;
  2. size_t rfind ( const char* s, size_t pos, size_t n ) const;
  3. size_t rfind ( const char* s, size_t pos = npos ) const;
  4. size_t rfind ( char c, size_t pos = npos ) const;
  5. //Searches the string for the content specified in either strs or c, and returns the position of the last occurrence in the string.
  1. size_t find_first_of ( const string& str, size_t pos = 0 ) const;
  2. size_t find_first_of ( const char* s, size_t pos, size_t n ) const;
  3. size_t find_first_of ( const char* s, size_t pos = 0 ) const;
  4. size_t find_first_of ( char c, size_t pos = 0 ) const;
  5. //Searches the string for any of the characters that are part of either strs or c, and returns the position of the first occurrence in the string.
  1. size_t find_last_of ( const string& str, size_t pos = npos ) const;
  2. size_t find_last_of ( const char* s, size_t pos, size_t n ) const;
  3. size_t find_last_of ( const char* s, size_t pos = npos ) const;
  4. size_t find_last_of ( char c, size_t pos = npos ) const;
  5. //Searches the string from the end for any of the characters that are part of either strs or c, and returns the position of the last occurrence in the string.
  1. size_t find_first_not_of ( const string& str, size_t pos = 0 ) const;
  2. size_t find_first_not_of ( const char* s, size_t pos, size_t n ) const;
  3. size_t find_first_not_of ( const char* s, size_t pos = 0 ) const;
  4. size_t find_first_not_of ( char c, size_t pos = 0 ) const;
  5. //Searches for the first character in the object which is not part of either strs or c, and returns its position.
  1. size_t find_last_not_of ( const string& str, size_t pos = npos ) const;
  2. size_t find_last_not_of ( const char* s, size_t pos, size_t n ) const;
  3. size_t find_last_not_of ( const char* s, size_t pos = npos ) const;
  4. size_t find_last_not_of ( char c, size_t pos = npos ) const;
  5. //Searches for the last character in the object which is not part of either strs or c, and returns its position.
  1. string substr ( size_t pos = 0, size_t n = npos ) const;
  2. //Returns a  object with its contents initialized to a substring of the current object.
  1. int compare ( const string& str ) const;
  2. int compare ( const char* s ) const;
  3. int compare ( size_t pos1, size_t n1, const string& str ) const;
  4. int compare ( size_t pos1, size_t n1, const char* s) const;
  5. int compare ( size_t pos1, size_t n1, const string& str, size_t pos2, size_t n2 ) const;
  6. int compare ( size_t pos1, size_t n1, const char* s, size_t n2) const;
  7. //Compares the content of this object (or a substring of it, known as compared (sub)string) to the content of a comparing string, which is formed according to the arguments passed.




阅读(1107) | 评论(0) | 转发(0) |
0

上一篇:String V Modifier

下一篇:拷贝构造函数

给主人留下些什么吧!~~