Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想用 C# 中字符串中的空格替换字符“。但是在编写函数时遇到了一个问题:
myString.Replace("""," ")
第一个论点似乎是一个问题。任何的想法
逃脱它:
myString.Replace("\""," ")
使用接受字符而不是字符串的重载
myString.Replace('"', ' ');
您需要通过在其前面放置 \ 来转义该字符:
myString=myString.Replace("\""," ");
或用户:
myString=myString.Replace('"',' ');
逃脱它。
您可以使用常规字符串:
或逐字 字符串:
myString.Replace(@""""," ")