Skip to content

Replace string with nothing

Mark

Asked Nov 16, 2005, 3:55 AM EST1 answer
Share
LinkedInX
Hi I need to replace the character \ in string with nothing.

This: myString.Replace('\',' '); leaves me with a compile error
Of course because \' is the escape for '
But what should be the exact syntax then??

Thanks in advance

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Just use the escape sequence for backslash. If you have a string x then: x = x.Replace('\\', ' '); This will replace all backslashes with spaces.
    0