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; }
C#去除HTML标签和可以根据传入值取固定长度的值
最新推荐文章于 2023-02-04 17:26:25 发布