using HtmlAgilityPack; using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace HTEXLib.COMM.Helpers { public class HtmlHelper { public static string DoUselessTag(string str) { if (str.StartsWith("
")) { str = str.Substring(4); } if (str.EndsWith("")) { str = str.Substring(0, str.Length - 1 - 2); } if (str.EndsWith("
")) { str = str.Substring(0, str.Length - 1 - 3); } if (str.EndsWith("
")) { str = str.Substring(0, str.Length - 1 - 4); } if (str.StartsWith("
") && !str.Contains("
")) { str = str.Replace("", ""); } if (str.StartsWith("
") && !str.Contains("
")) { str = str.Replace("", ""); } if (str.StartsWith("
") && !str.Contains("
")) { str = str.Replace("", ""); } if (str.EndsWith("
") && !str.Contains("") && !str.Contains("
") && !str.Contains("
")) { str = str.Replace("
", ""); } str = Regex.Replace(str, "]{0,})>\\s*
", ""); return str; } ///