开发者

.Net Function for Removing HTML from a String?

I'm looking for a good function to remov开发者_如何学Goe HTML from a string of HTML. Ideas?


I have not extensively tested this but found it a while back and has worked for my needs:

public static string StripTags(string html) {

    System.Text.RegularExpressions.Regex objRegExp = new System.Text.RegularExpressions.Regex("<(.|\\n)+?>");
    return objRegExp.Replace(html, "");

}


Take a look at this c-strip-xmlhtml-from-string or Html Agility Pack

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜