string + .length()
Try it yourself →String creation, concatenation, length.
Syntax
string name = "..."; name.length()
Description
std::string concatenates with +, .length()/.size() gives the length. Requires <string>.
Example
#include <iostream>
#include <string>
using namespace std;
int main() {
string s = "Hex";
s = s + "Library";
cout << s << " " << s.length() << endl;
return 0;
}Expected output
HexLibrary 10
When to use?
Text processing.