C#去除HTML标签

来源:互联网 发布:matlab计算矩阵行列式 编辑:程序博客网 时间:2024/05/01 22:32
public static string ReplaceHtml(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;}

0 0
原创粉丝点击