I have a long string (a path) with double backslashes, and I want to replace it with single backslashes:
string a = \"a\\\\b\\\\c\\\\d\"; string b = a.Rep
You're wrong. "\\" return \ (know as escaping)
"\\"
\
string a = "a\\b\\c\\d"; System.Console.WriteLine(a); // prints a\b\c\d string b = a.Replace(@"\\", @"\"); System.Console.WriteLine(b); // prints a\b\c\d
You don't even need string b = a.Replace(@"\\", @"\");
string b = a.Replace(@"\\", @"\");