C++ original (raw) string, learn in 3 minutes

cout<<R"(("",'\n','\a','\t''\n')";

insert image description here
The string wrapped in R"()" is the original character, no escape sequence, spaces and carriage returns are included.
Raw strings end when they encounter the first )", what if the string contains )"? For example:

cout << R"(abcde)","fghigk)";

insert image description here
The solution is to add any number of symmetrical characters between " and (,) and " to define the delimiter, but spaces, opening brackets, closing brackets, slashes, and control characters (such as tabs and newlines) Except, as follows:

 cout << R"!(abcde)","fghigk)!";

insert image description here

Guess you like

Origin blog.csdn.net/baidu_38495508/article/details/122363332