C# Class Nancy.Blog.StringHtmlExtensions

Show file Open project: NancyFx/Nancy.Blog

Public Methods

Method Description
StripHtml ( this html ) : string

Strips all HTML tags from a string

Truncate ( this text, int maxCharacters ) : string

Truncates text to a number of characters

Truncate ( this text, int maxCharacters, string trailingText ) : string

Truncates text to a number of characters and adds trailing text, i.e. elipses, to the end

TruncateHtml ( this html, int maxCharacters ) : string

Truncates a string containing HTML to a number of text characters, keeping whole words. The result contains HTML and any tags left open are closed.

TruncateHtml ( this html, int maxCharacters, string trailingText ) : string

Truncates a string containing HTML to a number of text characters, keeping whole words. The result contains HTML and any tags left open are closed.

TruncateWords ( this text, int maxCharacters ) : string

Truncates text and discars any partial words left at the end

TruncateWords ( this text, int maxCharacters, string trailingText ) : string

Truncates text and discars any partial words left at the end

Method Details

StripHtml() public static method

Strips all HTML tags from a string
public static StripHtml ( this html ) : string
html this
return string

Truncate() public static method

Truncates text to a number of characters
public static Truncate ( this text, int maxCharacters ) : string
text this
maxCharacters int
return string

Truncate() public static method

Truncates text to a number of characters and adds trailing text, i.e. elipses, to the end
public static Truncate ( this text, int maxCharacters, string trailingText ) : string
text this
maxCharacters int
trailingText string
return string

TruncateHtml() public static method

Truncates a string containing HTML to a number of text characters, keeping whole words. The result contains HTML and any tags left open are closed.
public static TruncateHtml ( this html, int maxCharacters ) : string
html this
maxCharacters int
return string

TruncateHtml() public static method

Truncates a string containing HTML to a number of text characters, keeping whole words. The result contains HTML and any tags left open are closed.
public static TruncateHtml ( this html, int maxCharacters, string trailingText ) : string
html this
maxCharacters int
trailingText string
return string

TruncateWords() public static method

Truncates text and discars any partial words left at the end
public static TruncateWords ( this text, int maxCharacters ) : string
text this
maxCharacters int
return string

TruncateWords() public static method

Truncates text and discars any partial words left at the end
public static TruncateWords ( this text, int maxCharacters, string trailingText ) : string
text this
maxCharacters int
trailingText string
return string