Main Page

Previous Page
Next Page

[Page 883]

Chapter 18. Class string and String Stream Processing

The difference between the almost-right word and the right word is really a large matterit's the difference between the lightning bug and the lightning.

Mark Twain

I have made this letter longer than usual, because I lack the time to make it short.

Blaise Pascal

Mum's the word.

Miguel de Cervantes

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


In this chapter you will 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 a string.

  • To convert strings to C-style strings and vice versa.

  • To use string iterators.

  • To perform input from and output to strings in memory.

[Page 884]


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 Strings 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



Self-Review Exercises

Answers to Self-Review Exercises


Previous Page
Next Page