C# Class TextHelper.Truncator

Exibir arquivo Open project: tylermercier/TextHelper

Public Methods

Method Description
Truncate ( this text, int maxLength = 30, string ommision = "...", string separator = "" ) : string

Truncates a given text after a given length.

Private Methods

Method Description
ApplySeparator ( string text, string separator ) : string

Method Details

Truncate() public static method

Truncates a given text after a given length.
public static Truncate ( this text, int maxLength = 30, string ommision = "...", string separator = "" ) : string
text this
maxLength int Length of truncated text (default is 30)
ommision string The last characters to be replaced with if truncated. (defaults to "...").
separator string Include if you want to truncate text at a natural break. For example, " " will truncate at word boundaries
return string