Monday, May 03, 2004

Converting HTML to Text

Converting HTML to Text

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write(StripTags("<b>Test</b>"));
}
/// <summary>
/// Removes tags from passed HTML
/// </summary>
/// <param name="HTML">Incoming HTML string</param>
/// <returns>Stripped text without HTML tags</returns>
string StripTags(string HTML)
{
return System.Text.RegularExpressions.Regex.Replace(HTML, "<[^>]*>", "");
}

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?