Skip to main content
Version: 2.11.10

Humanizer.TruncateExtensions

TruncateExtensions Class​

Allow strings to be truncated

public static class TruncateExtensions

Inheritance System.Object → TruncateExtensions

Methods​

TruncateExtensions.Truncate(this string, int) Method​

Truncate the string

public static string Truncate(this string input, int length);

Parameters​

input System.String

The string to be truncated

length System.Int32

The length to truncate to

Returns​

System.String
The truncated string

TruncateExtensions.Truncate(this string, int, ITruncator, TruncateFrom) Method​

Truncate the string

public static string Truncate(this string input, int length, Humanizer.ITruncator truncator, Humanizer.TruncateFrom from=Humanizer.TruncateFrom.Right);

Parameters​

input System.String

The string to be truncated

length System.Int32

The length to truncate to

truncator ITruncator

The truncate to use

from TruncateFrom

The enum value used to determine from where to truncate the string

Returns​

System.String
The truncated string

TruncateExtensions.Truncate(this string, int, string, ITruncator, TruncateFrom) Method​

Truncate the string

public static string Truncate(this string input, int length, string truncationString, Humanizer.ITruncator truncator, Humanizer.TruncateFrom from=Humanizer.TruncateFrom.Right);

Parameters​

input System.String

The string to be truncated

length System.Int32

The length to truncate to

truncationString System.String

The string used to truncate with

truncator ITruncator

The truncator to use

from TruncateFrom

The enum value used to determine from where to truncate the string

Returns​

System.String
The truncated string

TruncateExtensions.Truncate(this string, int, string, TruncateFrom) Method​

Truncate the string

public static string Truncate(this string input, int length, string truncationString, Humanizer.TruncateFrom from=Humanizer.TruncateFrom.Right);

Parameters​

input System.String

The string to be truncated

length System.Int32

The length to truncate to

truncationString System.String

The string used to truncate with

from TruncateFrom

The enum value used to determine from where to truncate the string

Returns​

System.String
The truncated string