I need to escape chars in a string I have, which content is C:\\blablabla\blabla\\bla\\SQL.exe to C:\blablabla\blabla\bla\SQL.exe so I could throw a process based on this SQL.exe file.
I tried with Mystring.Replace("\\", @"\"); and Mystring.Replace(@"\\", @"\"); but none worked.
How could I do this?
EDITED: Corrected type in string.
It looks like you’re trying to replace double backslash (
@"\\") in a string with single backslash (@"\"). If so try the followingNote: Are you sure that the string even contains double backslashes? Certain environments will print out a single backslash as a double (debugger for example). Your comment mentioned my approach didn’t work. That’s a flag that there’s not actually a double backslash in your string (else it would work).