< Previous | Contents | Next >

Using String Objects

string objects, which you met briefly in Chapter 1, are the perfect way to work with sequences of characters, whether youre writing a complete word puzzle game or simply storing a players name. A string is actually an object, and it provides its own set of member functions that allow you to do a range of things with the string objecteverything from simply getting its length to performing complex character substitutions. In addition, strings are defined so that they work intuitively with a few of the operators you already know.

 

Introducing the String Tester ProgramCreating string ObjectsConcatenating string ObjectsUsing the size() Member FunctionIndexing a string ObjectIterating through string ObjectsUsing the find() Member FunctionUsing the erase() Member FunctionUsing the empty() Member Function