码迷,mamicode.com
首页 > Windows程序 > 详细

C# 过滤空格、换行、script、style等等标签

时间:2015-12-21 23:25:42      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:

/// <summary>
/// 过滤空格、换行、script、style等等标签
/// </summary>
/// <param name="html">html的内容</param>
/// <returns>处理后的文本</returns>
internal static string SHTML(string html)
{
   html = html.Trim();
   html = html.Replace(@"/<script[^>]*?>(.*?)<\/script>/si", "");
   html = html.Replace(@"/<style[^>]*?>(.*?)<\/style>/si", "");
   html = html.Replace("\t", "");
   html = html.Replace("\r\n", "");
   html = html.Replace("\r", "");
   html = html.Replace("\n", "");
   html = html.Replace(" ", "");
   html = html.Replace("&nbsp", "");
   //html=html.Replace("","");
   return html;
}

  

C# 过滤空格、换行、script、style等等标签

标签:

原文地址:http://www.cnblogs.com/a7478729/p/5065193.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!