Val*_*ons -2 c# string escaping
我有需要包含引号的字符串变量.不足为奇的是,将""放入内部"a string like this"将结束字符串然后创建一个新字符串.
例如:
writer.WriteLine("{"); //first line is ok
writer.WriteLine(" "profiles": { ");
// the word "profiles" not treated as just another part of the string
// but I need to write this text, quotes and all:
// "profiles": {
Run Code Online (Sandbox Code Playgroud)
如何在字符串中加上引号?
你需要逃脱它们.
writer.WriteLine(" \"profiles\": { ");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
181 次 |
| 最近记录: |