【发布时间】:2016-02-12 16:28:21
【问题描述】:
我想将这个字符串'" 转换成这个字符串>>。
我已经读过this thread。
这是我尝试过的:
string str = "'"";
str = str.Replace("'\"",">>");
它没有抛出任何错误,但也没有做任何事情。非常感谢。
【问题讨论】:
-
将值赋回原字符串
str = str.Replace("'\"",">>"); -
您目前提供的代码无法编译。请提供minimal reproducible example。
-
另外,像你刚才那样编辑代码实际上可以解决问题
-
您的问题需要将第一个字符串更改为此
string str = "'\"";,否则代码可以正常工作。
标签: c# escaping str-replace double-quotes single-quotes