Standard C++ Library Class Reference
find_last_of(basic_string(s), pos)
find_last_of(basic_string(1, c), pos)
basic_string&
insert (size_type pos1, const basic_string& s);
basic_string&
insert (size_type pos, const basic_string& s,
size_type pos2 = 0, size_type n = npos);
basic_string&
insert (size_type pos, const charT* s, size_type n);
basic_string&
insert (size_type pos, const charT* s);
basic_string&
insert (size_type pos, size_type n, charT c);
Insert additional elements at position pos in this string. All of the variants of this function will throw an out_of_range
exception if pos > size(). All variants will also throw a length_error if the resulting string will exceed max_size().
Elements of this string will be moved apart as necessary to accommodate the inserted elements. All return a reference to
this string after completion.
The second variation of this function inserts the lesser of n and s.size() - pos2 characters of s, beginning at position pos2
in this string. This version will throw an out_of_range exception if pos2 > s.size(). The third version inserts n characters
of the array pointed to by s. The fourth inserts elements from the array pointed to by s up to, but not including, a
traits::eos() character. Finally, the fifth variation inserts n repetitions of c.
iterator
insert (iterator p, charT c = charT());
void
insert (iterator p, size_type n, charT c);
template<class InputIterator>
void
insert (iterator p, InputIterator first, InputIterator last);
Insert additional elements in this string immediately before the character referred to by p. All of these versions of insert
require that p is a valid iterator on this string. The first version inserts a copy of c. The second version inserts n
repetitions of c. The third version inserts characters in the range [first, last). The first version returns p.
size_type
length () const;
Return the number of elements contained in this string.
size_type
max_size () const;
Returns the maximum possible size of the string.
size_type
rfind (const basic_string& str, size_type pos = npos) const;
Searches for the last occurrence of the substring specified by str in this string, starting at position pos. Note that only the
first character of the substring must be <= pos; the remaining characters may extend beyond pos. If found, the index of
the first character of that matches substring is returned. If not found, npos is returned. Equality is defined by traits::eq().
size_type
rfind (const charT* s, size_type pos, size_type n) const;
size_type
rfind (const charT* s, size_type pos = npos) const;
size_type
rfind (charT c, size_type pos = npos) const;
Searches for the last sequence of characters in this string matching a specified string. The rfind variations return,
respectively:
rfind(basic_string(s,n), pos)
rfind(basic_string(s), pos)