I'm doing a C# project for school.
I need to extract a .zip
file but i have a problem.
I get the path where the file that is going to be extract is with FolderBrowserDialog
and everything is ok, but the FolderBrowserDialog
gives me something like "C:\Users\Zé Eduardo\Music"
, but i need something like this "C:\\Users\\Zé Eduardo\\Music"
.
How can i transform "\"
to "\\"
?
well, this is the answer to your question but you are probably asking the wrong question,
var transformedString = badString.Replace(@"\", @"\\");
The @
in the literal means, this is a verbatim string so normal escaping rules don't apply. Effectively, you don't need to escape the escape character.