c#中去掉字符串中html代码

2024-12-17 18:51:44
推荐回答(1个)
回答1:

using System.Text.RegularExpressions;

public string RemoveHtml(string strHtml)//取出html标签
{
string strhtml = Regex.Replace(strHtml, " <.+?> ", " "清笑敬);
strhtml = Regex.Replace(strhtml, "
", "升历 "答慎, RegexOptions.IgnoreCase);
return strhtml;
} 正则表达式最方便