Strings imported with
#include <string>
Create a string like:
Strings can adapt their length on the spot.
.length()
this method returns the length as a unsigned integer If you want, you can typecast this uint
Alternatively, you can use .ssize()
to get the length of string as signed integer
The Expense of Strings
Strings are expensive. You should avoid making copies of strings and should always pass by reference to the variable rather than passing by value.
String Literal Suffix
If you need to do quick literal typecasting(to avoid C-style strings)
Constexpr
There is no constexpr for strings
std::string view
a read-only string. Saves on memory required, rather than an entire string Implicitly typecasted from string
string views have the suffix sv you can use constexpr on string views