- Constructor
string s;string s(c_string_value);string s(char_array, size_type_count);string s(string_value);string s(string_value, size_type_index);string s(string_value, size_type_index, size_type_count);string s(size_type_count, char_value);string s(input_iterator_start, input_iterator_end);
- Char
S [I] s. at (I) // border check
- Iterator
s.begin()s.end()s.rbegin()s.rend()
- Append and value assignment
operator+=s.append(string_value)s.append(c_string_value)s.append(size_type_count, char_value)s.append(c_string_value, size_type_count)s.append(c_string_value, size_type_index, size_type_count)s.append(first_input_iterator, last_input_iterator)//operator=s.assign(string_value)s.assign(c_string_value)s.assign(size_type_count, char_value)s.assign(c_string_value, size_type_count)s.assign(c_string_value, size_type_index, size_type_count)s.assign(start_input_iterator, end_input_iterator)
- Convert to c-string
S. copy (char_array, size_type_count, size_type_index) s. c_str () // returns the ending char array address. The array belongs to s. Do not change s. data () // return the address of the char array that does not end with. The array belongs to s. Do not change it.
- Substring
s.substr(size_type_index)s.substr(size_type_index, size_type_count)
- Capacity and capacity adjustment
s.empty()s.capacity()s.length()s.size()s.max_size()s.reserve(size_type_value)s.resize(size_type_value, char_value)s.resize(size_type_value)
- Delete
S. clear () s. erase () // Delete All characters s. erase (size_type_index) s. erase (size_type_index, size_type_count) s. erase (iterator_position) s. erase (first_iterator, last_iterator)
- Search
// All the find statements return the lower mark value. If no value is found, string: npos // is returned to find chars. find (char_value) s. find (char_value, size_type_index) s. rfind (char_value) s. rfind (char_value, size_type_index) // find strings. find (string_value) s. find (string_value, size_type_index) // search for s from the index. rfind (string_value) s. rfind (string_value, size_type_index) // search for cstrings. find (c_string_value, size_type_index, size_type_count) s. rfind (c_string_value, size_type_index, size_type_count) // s. find_first_of (char_value) s. find_first_of (char_value, size_type_index) s. find_first_not_of (char_value) s. find_first_not_of (char_value, size_type_index) // returns the subscript s. find_first_of (string_value) s. find_first_of (string_value, size_type_index) s. find_first_not_of (string_value) s. find_first_not_of (string_value, size_type_index) // s. find_first_of (c_string_value, size_type_index, size_type_count) s. find_first_not_of (string_value, size_type_index, size_type_count. find_last_of (char_value) s. find_last_of (char_value, size_type_index) s. find_last_not_of (char_value) s. find_last_not_of (char_value, size_type_index) // s. find_last_of (string_value) s. find_last_of (string_value, size_type_index) s. find_last_not_of (string_value) s. find_last_not_of (string_value, size_type_index) // s. find_last_of (c_string_value, size_type_index, size_type_count) s. find_last_not_of (string_value, size_type_index, size_type_count)
- Insert value
S. insert (size_type_index, string_variable) s. insert (size_type_index, c_string_value) s. insert (size_type_index1, string_variable, size_type_index2, size_type_count) s. insert (size_type_index, c_string_value, size_type_count) s. insert (size_type_index, size_type_count, char_value) // in c ++, the function parameters are always count before val s. insert (iterator_position, size_type_count, char_value) s. insert (iterator_position, char_value) s. insert (iterator_position, input_iterator_first, input_iterator_last. push_back (char_value)
- Character/string replacement
s.replace(size_type_index, size_type_count, string_value)s.replace(iterator_first, iterator_last, string_values.replace(size_type_index1, size_type_count1, string_value, size_type_index2, size_type_count2)s.replace(size_type_index, size_type_count, c_string_value)s.replace(iterator_first, iterator_last, c_string_value)s.replace(size_type_index, size_type_count1, c_string_value, size_type_count2)s.replace(iterator_first, iterator_last, c_string_value, size_type_count)s.replace(size_type_index, size_type_count1, size_type_count2, char_value)s.replace(iterator_first, iterator_last, size_type_count, char_value)s.replace(iterator_first, iterator_last, input_iterator_start, input_iterator_end)
- Comparison
// = ,! =, <,> <=, >= Already overloaded /// compare returns an int: s-others.compare (string_value) s. compare (size_type_index, size_type_count, string_value) s. compare (size_type_index1, size_type_count1, string_value, size_type_index2, size_type_count2) // s. compare (c_string_value) s. compare (size_type_index, size_type_count, c_string_value) s. compare (size_type_index, size_type_count1, c_string_value, size_type_count2)
- Other functions
S. swap (string_variable) /// swap (string_variable1, substring) // getline (inStream, string_variable) // The string result does not contain delimitergetline (inStream, string_variable, char_delimiter_value)