Akshay
Akshay

Reputation: 29

Remove escape character "\" from string

I need to remove \ character from imagepth string variable:

imagepth = "# Eval(\"Name\",\"Gallary/\"" + imgwords[4] + "\"/Images/{0}\")";

Upvotes: 2

Views: 27618

Answers (3)

Zigzagas
Zigzagas

Reputation: 73

Here is a working syntax for me:

str = str.Replace("\"", string.Empty);

Upvotes: 1

Adrian
Adrian

Reputation: 713

You can use Replace method to replace "\\" with a empty string

   str = str.Replace("\\", "");

Upvotes: 6

Rookasaur
Rookasaur

Reputation: 541

Regex Unescape will remove all escaping characters from a string, here is a link to this information:

http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.unescape.aspx

Upvotes: 2

Related Questions