首页 > 学院 > 开发设计 > 正文

C#去除HTML标签

2019-11-17 02:41:50
字体:
来源:转载
供稿:网友

C#去除HTML标签

public static string ReplaceHtmlTag(string html, int length = 0){    string strText = System.Text.RegularExPRessions.Regex.Replace(html, "<[^>]+>", "");    strText = System.Text.RegularExpressions.Regex.Replace(strText, "&[^;]+;", "");    if (length > 0  && strText.Length > length)        return strText.Substring(0, length);    return strText;}
转载自:http://www.VEVb.com/youring2/archive/2013/04/03/2997826.html

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表