Table of Contents

C++ Strings library

https://en.cppreference.com/w/cpp/string

The C++ strings library includes support for three general types of strings:

{{lc|std::basic_string}}

The templated class

generalizes how sequences of characters are manipulated and stored. String creation, manipulation, and destruction are all handled by a convenient set of class methods and related functions.

Several specializations of

are provided for commonly-used types:

|

}}

|

}}

|

}}

|

}}

|

}}

The templated class

provides a lightweight object that offers read-only access to a string or a part of a string using an interface similar to the interface of

.

Several specializations of

are provided for commonly-used types:

|

}}

|

}}

|

}}

|

}}

|

}}

}}

Null-terminated strings

Null-terminated strings are arrays of characters that are terminated by a special null character. C++ provides functions to create, inspect, and modify null-terminated strings.

There are three types of null-terminated strings:

Additional support

{{lc|std::char_traits}}

The string library also provides class template

that defines types and functions for

}}. The following specializations are defined:

Conversions and classification

The localizations library provides support for string conversions (e.g.

or

) as well as functions that classify characters (e.g.

or

).

See also