C# Класс BudgetAnalyser.Engine.StringExtension

An extension class for string.
Показать файл Открыть проект

Открытые методы

Метод Описание
AnOrA ( this instance, bool properCase = false ) : string

Returns the appropriate 'An' or 'A' prefix for the given string. The given string is not included in the return text.

IsNothing ( this instance ) : bool

Returns true if the string is null, whitespace or empty. Equivelant to IsNullOrWhiteSpace

IsSomething ( this instance ) : bool

Returns true if the string is not null, not whitespace, and not empty. The direct opporsite of IsNothing

SplitLines ( this instance, int numberOfLines ) : string[]

An extension to the string.Split(char[]) method. This method splits at new line characters, trims off trailing whitespace, and returns the specified number of lines.

TrimEndSafely ( this instance ) : string

Trims the end of a string safely. If the string is null, null is returned.

Truncate ( this instance, int truncateToLength, bool useEllipses = false ) : string

Truncates the right of a string to the specified length, but only if it exceeds that length. Optionally the returned string can include ellipses.

TruncateLeft ( this instance, int truncateToLength, bool useEllipses = false ) : string

Truncates the left of a string to the specified length, but only if it exceeds that length. Optionally the returned string can include ellipses.

Описание методов

AnOrA() публичный статический Метод

Returns the appropriate 'An' or 'A' prefix for the given string. The given string is not included in the return text.
public static AnOrA ( this instance, bool properCase = false ) : string
instance this The string to determine the prefix for.
properCase bool A boolean to indicate if the prefix should be proper-cased or not.
Результат string

IsNothing() публичный статический Метод

Returns true if the string is null, whitespace or empty. Equivelant to IsNullOrWhiteSpace
public static IsNothing ( this instance ) : bool
instance this
Результат bool

IsSomething() публичный статический Метод

Returns true if the string is not null, not whitespace, and not empty. The direct opporsite of IsNothing
public static IsSomething ( this instance ) : bool
instance this
Результат bool

SplitLines() публичный статический Метод

An extension to the string.Split(char[]) method. This method splits at new line characters, trims off trailing whitespace, and returns the specified number of lines.
public static SplitLines ( this instance, int numberOfLines ) : string[]
instance this
numberOfLines int
Результат string[]

TrimEndSafely() публичный статический Метод

Trims the end of a string safely. If the string is null, null is returned.
public static TrimEndSafely ( this instance ) : string
instance this
Результат string

Truncate() публичный статический Метод

Truncates the right of a string to the specified length, but only if it exceeds that length. Optionally the returned string can include ellipses.
public static Truncate ( this instance, int truncateToLength, bool useEllipses = false ) : string
instance this
truncateToLength int
useEllipses bool
Результат string

TruncateLeft() публичный статический Метод

Truncates the left of a string to the specified length, but only if it exceeds that length. Optionally the returned string can include ellipses.
public static TruncateLeft ( this instance, int truncateToLength, bool useEllipses = false ) : string
instance this
truncateToLength int
useEllipses bool
Результат string