在C#中,我们可以用@定义一个复杂的字符串:
string str = @"This is the first line.\r\nThis is still the first line";
Run Code Online (Sandbox Code Playgroud)
在C++中怎么样?如果我们有这样的东西,我们不需要为所有特殊字符使用转换符号'\'.
在C++ 11(仅)中,您可以使用原始字符串文字:
std::string str = R"(This is the first line.\r\nThis is still the first line)";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
124 次 |
| 最近记录: |