Once you’ve created strings, it’s often useful to know how long they are. This is where length and capacity operations come into play. We’ll also discuss various ways to convert std::string back into C-style strings, so you can use them with functions that expect strings of type char*.
Length of a string
The length . . . → Read More: 17.3 — std::string length and capacity
In this lesson, we’ll take a look at how to construct objects of std::string, as well as how to create strings from numbers and vice-versa.
The string classes have a number of constructors that can be used to create strings. We’ll take a look at each of them here.
Note: string::size_type resolves . . . → Read More: 17.2 — std::string construction and destruction
The standard library contains many useful classes — but perhaps the most useful is std::string. std::string (and std::wstring) is a string class that provides many operations to assign, compare, and modify strings. In this chapter, we’ll look into these string classes in depth.
Note: C-style strings will be referred to as “C-style strings”, whereas . . . → Read More: 17.1 — std::string and std::wstring
Now that you’ve learned some basics about programs, let’s look more closely at how to design a program. When you sit down to write a program, generally you have some sort of problem that you’d like to solve, or situation that you’d like to simulate. New programmers often have trouble figuring out how to . . . → Read More: 1.10a — How to design your first programs