.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
精彩评论