How to remove backslashes in a string
<p>I get a string from a website called &quot;willekeurigwoord.nl&quot; which means random word. So when I get the string from the site with HtmlAgilityPack, it is formatted like &quot;\n\t\t\tkegelvrucht\r\n \t\n\t\t&quot;.</p>
<p>So the word that I get is &quot;kegelvrucht&quot; but before and after the word there are backslashes which when I try to remove they get ignored even when I put &quot;@&quot; or use double backslashes (&quot;\&quot;) in front of the string.</p>
<p>So my question is, how do I remove the \ in my string?</p>
<p>I did try everything that is in the comment lines.</p>
<pre><code>    private string RandomWordOnline() //Get the word online
    {
        //get string from htlm file with htmlagilitypack
        var webGet = new HtmlWeb();
        var doc = webGet.Load(&quot;http://www.willekeurigwoord.nl/&quot;);
        String word = doc.DocumentNode.SelectSingleNode(&quot;//h1&quot;).InnerText;

        //word = word.Replace(@&quot;\&quot;, &quot;&quot;);            
        //word = @word.Trim(new char[] {' ','\\'});
        //word = word.Substring(8, word.Length - 13);
        //word = word.Substring(0, 13);

        //trying to remove backslash, does not work
        for (int i = 0; i &lt; word.Length; i++)
        {

            char chrWord = Convert.ToChar(word.Substring(i, 1));
            char backslash = Convert.ToChar(@&quot;\&quot;);
            if (chrWord == backslash)
            {
                word = word.Remove(i, 1);
            }

        }

        return word;           
    }
</code></pre>