Html Decode - CSharp System

CSharp examples for System:String HTML

Description

Html Decode

Demo Code


using System;/*w w w.jav a  2  s  . c o m*/

public class Main{
        public static String HtmlDecode(String source)
        {
            if (String.IsNullOrEmpty(source))
            {
                return String.Empty;
            }

            String dest = source;

            dest = dest.Replace("<br/>", Environment.NewLine);
            dest = dest.Replace("&nbsp;", " ");
            dest = dest.Replace("&quot;", "\"");
            dest = dest.Replace("&gt;", ">");
            dest = dest.Replace("&lt;", "<");
            dest = dest.Replace("&amp;", "&");
            
            return dest;
        }
}

Related Tutorials