C# Class TVSorter.StringExtensions

Extension methods for the string type.
Mostra file Open project: a-jackson/tvsorter

Public Methods

Method Description
FormatLength ( this str, int length ) : string

Returns a string that is exactly the length specified, either truncating or padding the specified string.

Truncate ( this str, int length = 30 ) : string

Returns a string that is truncated to the specified length if it is longer.

Private Methods

Method Description
AlphaNumericOnly ( this str ) : string

Removes special characters and spaces from the string.

GetFileSafeName ( this str ) : string

Strips any characters that can't be in a file name from the specified string.

RemoveSpacerChars ( this str ) : string

Removes the spacer chars from the specfied string.

RemoveSpecialChars ( this str ) : string

Removes special characters from the string.

Method Details

FormatLength() public static method

Returns a string that is exactly the length specified, either truncating or padding the specified string.
public static FormatLength ( this str, int length ) : string
str this The string to format.
length int The target length.
return string

Truncate() public static method

Returns a string that is truncated to the specified length if it is longer.
public static Truncate ( this str, int length = 30 ) : string
str this The string to truncate.
length int The length to truncate to.
return string