18. Class string and String Stream Processing
Objectives |
|
In this chapter you'll learn:
-
To use class string from the
C++ Standard Library to treat strings as full-fledged objects.
-
To assign, concatenate, compare, search and
swap strings.
-
To determine string characteristics.
-
To find, replace and insert characters
in strings.
-
To convert strings to C-style
strings and vice versa.
-
To use string iterators.
-
To perform input from and output to strings in
memory. |
Suit
the action to the word, the word to the action; with this special observance,
that you o'erstep not the modesty of nature.
—William
Shakespeare
The
difference between the almost-right word and the right word is really a large
matter—it's the difference between the lightning bug and the
lightning.
—Mark Twain
Mum's the word.
—Miguel de
Cervantes
I
have made this letter longer than usual, because I lack the time to make it
short.
—Blaise
Pascal
Outline |
|
| 18.1 |
Introduction |
| 18.2 |
string Assignment and
Concatenation |
| 18.3 |
Comparing
strings |
| 18.4 |
Substrings |
| 18.5 |
Swapping strings |
| 18.6 |
string
Characteristics |
| 18.7 |
Finding Substrings and Characters
in a string |
| 18.8 |
Replacing Characters in a
string |
| 18.9 |
Inserting Characters into a
string |
| 18.10 |
Conversion to C-Style char
* Strings |
| 18.11 |
Iterators |
| 18.12 |
String Stream Processing |
| 18.13 |
Wrap-Up |
|
|
|
|
|
|