AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

StringExtensions..::..StripHTML Method

Removes all HTML tags from the string, returning only the text content. Entities are decoded first so that HTML which arrived encoded (for example <p>) has its tags exposed and stripped; script and style blocks are removed along with their contents, and tags that span multiple lines are handled.

Namespace:  AdvantageCMS.Core.Common
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public static string StripHTML(
	this string text
)

Parameters

text
Type: String
The HTML string to strip. May be plain HTML or HTML-encoded HTML.

Return Value

The plain-text content with all HTML tags removed.

Examples


C#
string plain = "<p>Hello <b>World</b></p>".StripHTML(); // returns "Hello World"