如何在字符串中将\更改为\\
问题描述:
你好
如何在C#中将字符串中的\更改为\\
例如:
"hello \ im \ nobody"必须为"hello \\ im \\ nobody"
Job
Hello
how can I change \ into \\ in a string in C#
example:
"hello\im\nobody" needs to be "hello\\im\\nobody"
Job
答
string str1=@"hello\im\nobody";
string str2 = str1.Replace(@"\", @"\\");
MessageBox.Show (str2);