I would like to replace a straight quotation mark (\") using C#.
I might be missing something small, but I can\'t get it with a normal string.Replace();
I agree with Heinzi, you should use "
instead of &
, and &
means "&"
Btw, after invoking the Replace method, don't forget to set the value to someWord again:
someWord = someWord.Replace("\"", """);
And there is another way to do it. Add the reference System.Web, and using System.Web; then:
someWord = HttpUtility.HtmlEncode(someWord);