Standard C++ Library Class Reference
c_str () const;
const charT*
data () const;
Return a pointer to the initial element of an array whose first size() elements are copies of the elements in this string. A
traits::eos() element is appended to the end. The elements of the array may not be altered, and the returned pointer is
only valid until a non-const member function of this string is called. If size() is zero, the data() function returns a NULL
pointer.
bool empty () const;
Returns size() == 0.
basic_string&
erase (size_type pos = 0, size_type n = npos);
iterator
erase (iterator p);
iterator
erase (iterator first, iterator last);
This function removes elements from the string, collapsing the remaining elements, as necessary, to remove any space
left empty. The first version of the function removes the smaller of n and size() - pos starting at position pos. An
out_of_range exception will be thrown if pos > size(). The second version requires that p is a valid iterator on this string,
and removes the character referred to by p. The last version of erase requires that both first and last are valid iterators on
this string, and removes the characters defined by the range [first, last). The destructors for all removed characters are
called. All versions of erase return a reference to this string after completion.
size_type
find (const basic_string& str, size_type pos = 0) const;
Searches for the first occurance of the substring specified by str in this string, starting at position pos. If found, it returns
the index of the first character of the matching substring. If not found, returns npos. Equality is defined by traits::eq().
size_type
find (const charT* s, size_type pos, size_type n) const;
size_type
find (const charT* s, size_type pos = 0) const;
size_type
find (charT c, size_type pos = 0) const;
Search for the first sequence of characters in this string that match a specified string. The variations of this function
return, respectively:
find(basic_string(s,n), pos)
find(basic_string(s), pos)
find(basic_string(1, c), pos)
size_type
find_first_not_of (const basic_string& str,
size_type pos = 0) const;
Searches for the first element of this string at or after position pos that is not equal to any element of str. If found,
find_first_not_of returns the index of the non-matching character. If all of the characters match, the function returns
npos. Equality is defined by traits::eq().
size_type
find_first_not_of (const charT* s,
size_type pos, size_type n) const;
size_type
find_first_not_of (const charT* s,
size_type pos = 0) const;
size_type
find_first_not_of (charT c, size_type pos = 0) const;
Search for the first element in this string at or after position pos that is not equal to any element of a given set of
characters. The members return, respectively: