从html中提取纯文本

public string StripHT(string strHtml) //从html中提取纯文本
{
Regex regex = new Regex("<.+?>", RegexOptions.IgnoreCase);
string strOutput = regex.Replace(strHtml, "");//替换掉"<"和">"之间的内容
strOutput = strOutput.Replace("<", "");
strOutput = strOutput.Replace(">", "");
strOutput = strOutput.Replace("&nbsp;", "");
return strOutput;
}
posted @ 2020-01-09 14:57  噜啦啦0001  阅读(2083)  评论(0编辑  收藏  举报