日期:2014-05-19  浏览次数:20438 次

如何把字符串中的"\\"替换为"\"(string.replace("\\","\")行不通)
如何把字符串中的 "\\ "替换为 "\ "(string.replace( "\\ ", "\ ")行不通)

------解决方案--------------------
string.replace( "\\\\ ", "\\ ")
------解决方案--------------------
str = str.Replace( "\\\\ ", "\\ ");
------解决方案--------------------
str = str.Replace( "\\\\ ", "\\ ");

------解决方案--------------------
str = str.Replace(@ "\\ ",@ "\ ");
------解决方案--------------------
是注意转义字符.
------解决方案--------------------
str = str.Replace( "\\\\ ", "\\ ");
------解决方案--------------------
同意楼上的解释, " "中出现\是转义字符的标志,所以第二个才是真正的\,要弄出1个\就要写2个\,明白了吧?
------解决方案--------------------
str = str.Replace(@ "\\ ",@ "\ ");

------解决方案--------------------
up viena(维也纳N02) shalen520(Love will keep us alive)
------解决方案--------------------
str = str.Replace(@ "\\ ",@ "\ ");