Additional String Member Functions

The string class overloads many operators and has numerous (over a hundred) member functions.

The length or size member function returns an unsigned integer value that gives the number of characters currently in the string. The string class actually defines a data type called size_type to store the length or size of a string. An example:

   string firstname, fullname;
   firstname = "George";
   cout < < firstname.length( ) < < endl;            // prints 6
   fullname = firstname + " Warren Bush";
   cout < < fullname.size( ) < < endl;            // prints 18