最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

去除HTML標(biāo)簽刪除HTML示例代碼

 更新時(shí)間:2014年06月04日 17:19:39   作者:  
這篇文章主要介紹了如何去除HTML標(biāo)簽、刪除HTML。示例中使用到了一個(gè)正則,直接使用就可以了
復(fù)制代碼 代碼如下:

/// <summary>
/// 去除HTML標(biāo)簽
/// </summary>
/// <param name="Htmlstring"></param>
/// <returns></returns>
public static string DeleteHTML(string Htmlstring)
{
//刪除HTML
Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
Htmlstring = Htmlstring.Replace("<", "");
Htmlstring = Htmlstring.Replace(">", "");
Htmlstring = Htmlstring.Replace("\r\n", "");
return Htmlstring;
}

相關(guān)文章

最新評論

天气| 信宜市| 巨鹿县| 鹿泉市| 五华县| 门头沟区| 临沭县| 扎兰屯市| 新龙县| 南宫市| 新巴尔虎左旗| 海盐县| 定南县| 汝南县| 棋牌| 防城港市| 晋宁县| 洪雅县| 湘潭市| 延长县| 宜章县| 景德镇市| 遂昌县| 淳安县| 湖州市| 舒兰市| 塘沽区| 兰州市| 蓝山县| 文成县| 久治县| 永兴县| 抚顺市| 奎屯市| 揭西县| 寿光市| 青海省| 珠海市| 徐闻县| 余庆县| 酉阳|