First, initialize the string object:
Direct initialization: String A ("value");
Copy initialization: String a = "value";
Second, read and write String object
Note: CIN ignores the beginning and ends of the blanks, leaving the whitespace to use getline;
The empty function determines whether it is empty, and the size function calculates the string length.
Multiple literal values cannot be added directly to a string object, and the string literal is not a string object.
Iii. use of the scope for statement
stringStr"some,string!!!"); for(Auto c:str) {cout<< c << Endl;//print each character row by line} decltype (Str.size ()) punct_cnt=0; for(Auto i:str) {if(ispunct (i)) {++punct_cnt; }} cout<< punct_cnt<<endl;//Output Punctuation Number 4
for (auto &b:str)
{
b = ToUpper (b); lowercase to uppercase
}
cout<<str<<endl;
C + + Learning Note (7) standard library String class