20.8. C String-Manipulation Functions

The string-handling library provides any useful functions for manipulating string data, comparing strings, searching strings for characters and other strings, tokenizing strings (separating strings into logical pieces such as the separate words in a sentence) and determining the length of strings. This section presents some common string-manipulation functions of the string-handling library (from the C++ standard library). The functions are summarized in Fig. 20.21; then each is used in a live-code example. The prototypes for these functions are located in header <cstring>.

Image
Image

Fig. 20.21. String-manipulation functions of the string-handling library.

Several functions in Fig. 20.21 contain parameters with data type size_t. This type is defined in the header <cstring> to be an unsigned integral type such as unsigned int or unsigned long.


Image Common Programming Error 20.7

Forgetting to include the <cstring> header when using functions from the string-handling library causes compilation errors.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.81.214