Remove Html Whitespaces - CSharp System

CSharp examples for System:String HTML

Description

Remove Html Whitespaces

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Net;
using System.Linq;
using System.Globalization;
using System.Collections.Generic;
using System;/* ww  w.  j  a v a  2s .c  o  m*/

public class Main{
        public static string RemoveHtmlWhitespaces(this string html)
        {
            html = new Regex(@">\s+<").Replace(html, "><");
            html = new Regex(@"\n\s+").Replace(html, string.Empty);
            return html;
        }
}

Related Tutorials