How to specify a character

I am trying to use string.Remove to remove all occurrences of "in my html, but I forgot how to tell it to use" as a character instead of its usual value.

Thank.

+5
source share
5 answers

You need to avoid this with help \, so write \"instead "where you mean ".

string.Remove removed the part of the string based on the start index and length, so this is not what you are really looking for, but replacing it will help you get rid of everything ".

myString.Replace("\"","")
+8
source
\"

Just avoid backslash quotes.

+2
source

" : \":

string newString = myHtml.Replace("\"", string.Empty)
+2

The usual way to escape characters in most backslash environments.

So you are looking \".

+2
source

you can also write

"

to display "characters in html

+2
source

All Articles