您的位置:首页 > Web前端 > HTML

从html中提取纯文本

2012-10-18 21:53 197 查看
using System.Text.RegularExpressions;

private 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(" ", "");
return strOutput;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: