C#去除HTML标签

来源:互联网 发布:彩虹秒赞最新源码 编辑:程序博客网 时间:2024/05/22 15:04
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;}
原创粉丝点击