How can i add two backslashes to a string?
i'm having trouble putting two backslashes in a string, here's what I was trying to do.. I needed to replace the single backslash in a file path with two backslashes, I have written a little method to do something similar already. for example:
string filelocation = Regex.Replace(prelocation,"\"","");
will replace all double quotes in the string with nothing (in another word it takes out the double quotes) and i know this works
however, with backslashes, it doesn't apear to work...for example
doesnt work. the program stop with an error that says
string filelocation = Regex.Replace(prelocation,"\\","\\\\");
"Additional information: parsing "\" - Illegal \ at end of pattern."
I've also even tried
which also gives the same error
string filelocation = Regex.Replace(prelocation,@"\",@"\\");
any help is appreciated!! :rolleyes: