什么是C ++等效的C#@符号前缀字符串? [英] What is the C++ equivalent of the C# @ symbol prefixing strings?

查看:216
本文介绍了什么是C ++等效的C#@符号前缀字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C#@符号前缀字符串的C ++等效项是什么?要自动转义符号?

What is the C++ equivalent of the C# @ symbol prefixing strings? For escaping symbols automatically?

示例: var howManySlashesAreThereIn = @\\\\\\;

推荐答案

在C ++ 11中,可以使用原始字符串文字:

In C++11, you can use raw string literals:

std::string s = R"(This\is\a\raw\string\literal)";

std::string s = R"*(This \one contains \a )", which would normally end the string)*";

以下是 C ++ 11常见问题字词,以及参考资料

这篇关于什么是C ++等效的C#@符号前缀字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆