Working with Strings and String Views
Marc Gregoire · 2021
This chapter helps the readers understand the differences between C-style strings and C++ strings. It presents the details of the C++ std::string class and explores why the readers should use std::string_view. The chapter provides information on raw string literals and explores how to format strings. Strings in languages that have supported them as first-class objects tend to have a number of attractive features, such as being able to expand to any size or to have substrings extracted or replaced. The C++ Standard Library provides both high-level and low-level numeric conversion functions, explained in this chapter. C++20 string formatting library is a powerful mechanism to format strings with fine-grained control over how the formatted output should look.