adsense

Saturday, October 17, 2020

.Net get plain text from HTML

There can be situations where you want to get plain text from HTML content.  We can use Regex and HttpUtility.HtmlDecode as the easiest way to get plain text shown below.

String plainText =HttpUtility.HtmlDecode( Regex.Replace(HtmlString, "<(.|\n)*?>", "") );


Cheers,

Samitha

No comments:

Post a Comment