String class
String objects are a special type of container, specifically designed to operate with sequences of characters.
Unlike traditional c-strings, which are mere sequences of characters in a memory array, C++ string objects belong to a class with many built-in features to operate with strings in a more intuitive way and with some additional useful features common to C++ containers.
The string class is an instantiation of the basic_string class template, defined in as:
typedef basic_string<char> string; |
Member functions
|
Construct string object (constructor member) |
|
String assignment (public member function) |
Iterators:
|
Return iterator to beginning (public member function) |
|
Return iterator to end (public member function) |
|
Return reverse iterator to reverse beginning (public member function) |
|
Return reverse iterator to reverse end (public member function) |
Capacity:
|
Return length of string (public member function) |
|
Return length of string (public member function) |
|
Return maximum size of string (public member function) |
|
Resize string (public member function) |
|
Return size of allocated storage (public member function) |
|
Request a change in capacity (public member function) |
|
Clear string (public member function) |
|
Test if string is empty (public member function) |
Element access:
|
Get character in string (public member function) |
|
Get character in string (public member function) |
Modifiers:
|
Append to string (public member function) |
|
Append to string (public member function) |
|
Append character to string (public member function) |
|
Assign content to string (public member function) |
|
Insert into string (public member function) |
|
Erase characters from string (public member function) |
|
Replace part of string (public member function) |
|
Copy sequence of characters from string (public member function) |
|
Swap contents with another string (public member function) |
String operations:
|
Get C string equivalent (public member function) |
|
Get string data (public member function) |
|
Get allocator (public member function) |
|
Find content in string (public member function) |
|
Find last occurrence of content in string (public member function) |
|
Find character in string (public member function) |
|
Find character in string from the end (public member function) |
|
Find absence of character in string |
|
Find absence of character in string from the end (public member function) |
|
Generate substring (public member function) |
|
Compare strings (public member function) |
阅读(1093) | 评论(0) | 转发(0) |