std::basic_string::rfind

size_type rfind( const basic_string& str, size_type pos = npos ) const; (1) size_type rfind( const CharT* s, size_type pos, size_type count ) const; (2) size_type rfind( const CharT* s, size_type pos = npos ) const; (3) size_type rfind( CharT ch, size_type pos = npos ) const; (4) Finds the last substring equal to the given character sequence. Search begins at pos, i.e. the found substring must not begin in a position following pos. If npos or any value not smaller

std::basic_string::resize

void resize( size_type count ); (1) void resize( size_type count, CharT ch ); (2) Resizes the string to contain count characters. If the current size is less than count, additional characters are appended. If the current size is greater than count, the string is reduced to its first count elements. The first version initializes new characters to CharT(), the second version initializes new characters to ch. Parameters count - new size of the string ch - character to i

std::basic_string::reserve

void reserve( size_type new_cap = 0 ); Informs a std::basic_string object of a planned change in size, so that it can manage the storage allocation appropriately. If new_cap is greater than the current capacity(), new storage is allocated, and capacity() is made equal or greater than new_cap. If new_cap is less than the current capacity(), this is a non-binding shrink request. If new_cap is less than the current size(), this is a non-binding shrink-to-fit request equivalent to shri

std::basic_string::replace

basic_string& replace( size_type pos, size_type count, const basic_string& str ); (1) basic_string& replace( const_iterator first, const_iterator last, const basic_string& str ); (1) (2) basic_string& replace( size_type pos, size_type count, const basic_string& str, size_type pos2, size_type count2 ); (until C++14) basic_string& replace( size_type pos, size

std::basic_string::rend

reverse_iterator rend(); const_reverse_iterator rend() const; const_reverse_iterator crend() const; (since C++11) Returns a reverse iterator to the character following the last character of the reversed string. It corresponds to the character preceding the first character of the non-reversed string. This character acts as a placeholder, attempting to access it results in undefined behavior. Parameters (none). Return value reverse iterator to the character following the

std::basic_string::rbegin

reverse_iterator rbegin(); const_reverse_iterator rbegin() const; const_reverse_iterator crbegin() const; (since C++11) Returns a reverse iterator to the first character of the reversed string. It corresponds to the last character of the non-reversed string. Parameters (none). Return value reverse iterator to the first character. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Example #include <iostr

std::basic_string::push_back

void push_back( CharT ch ); Appends the given character ch to the end of the string. Parameters ch - the character to append Return value (none). Complexity Amortized constant. Exceptions If an exception is thrown for any reason, this function has no effect (strong exception guarantee). (since C++11). If the operation would result in size() > max_size(), throws std::length_error. See also pop_back (C++11) removes the last character (public member functio

std::basic_string::pop_back

void pop_back(); (since C++11) Removes the last character from the string. Equivalent to erase(size()-1, 1), except the behavior is undefined if the string is empty. Parameters (none). Return value (none). Complexity Constant. Exceptions Does not throw. See also push_back appends a character to the end (public member function) erase removes characters (public member function)

std::basic_string::operator[]

reference operator[]( size_type pos ); (1) const_reference operator[]( size_type pos ) const; (2) Returns a reference to the character at specified location pos. No bounds checking is performed. 1) If pos == size(), the behavior is undefined. 2) If pos == size(), a reference to the character with value CharT() (the null character) is returned. (until C++11) If pos == size(), a reference to the character with value CharT() (the null character) is returned. For the first

std::basic_string::npos

static const size_type npos = -1; This is a special value equal to the maximum value representable by the type size_type. The exact meaning depends on context, but it is generally used either as end of string indicator by the functions that expect a string index or as the error indicator by the functions that return a string index. Example #include <iostream> #include <bitset> #include <string> int main() { // string search functions return npos if nothing i