C# Класс EnergyTrading.Extensions.StringExtensions

Показать файл Открыть проект

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

Метод Описание
AppendValueToEndIfMissing ( this source, string value ) : string

Append the value to the source if the source is not null/whitespace and the source does not end with the value.

DefaultIfNullOrEmpty ( this source, string defaultValue ) : string

Return the default value if the source value is null or empty.

Matches ( this validValues, string itemToMatch ) : bool

checks to see if a supplied string matches with any item in the list allows for the following simple logic all currently case-insensitive * or *.* => match all items *xxx or *.xxx => EndsWith("xxx") xxx* or xxx.* => StartsWith("xxx") *xxx* or *.xxx.* => Contains("xxx") xxx => string.Compare() == 0

Matches ( this validValues, string itemToMatch, int &noOfMatchedCharacters ) : bool

checks to see if a supplied string matches with any item in the list allows for the following simple logic all currently case-insensitive * or *.* => match all items *xxx or *.xxx => EndsWith("xxx") xxx* or xxx.* => StartsWith("xxx") *xxx* or *.xxx.* => Contains("xxx") xxx => string.Compare() == 0

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

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

Append the value to the source if the source is not null/whitespace and the source does not end with the value.
public static AppendValueToEndIfMissing ( this source, string value ) : string
source this Value to check.
value string Value to append
Результат string

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

Return the default value if the source value is null or empty.
public static DefaultIfNullOrEmpty ( this source, string defaultValue ) : string
source this Value to check
defaultValue string Default value
Результат string

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

checks to see if a supplied string matches with any item in the list allows for the following simple logic all currently case-insensitive * or *.* => match all items *xxx or *.xxx => EndsWith("xxx") xxx* or xxx.* => StartsWith("xxx") *xxx* or *.xxx.* => Contains("xxx") xxx => string.Compare() == 0
public static Matches ( this validValues, string itemToMatch ) : bool
validValues this the list of expressions to match against
itemToMatch string the string to match
Результат bool

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

checks to see if a supplied string matches with any item in the list allows for the following simple logic all currently case-insensitive * or *.* => match all items *xxx or *.xxx => EndsWith("xxx") xxx* or xxx.* => StartsWith("xxx") *xxx* or *.xxx.* => Contains("xxx") xxx => string.Compare() == 0
public static Matches ( this validValues, string itemToMatch, int &noOfMatchedCharacters ) : bool
validValues this the list of expressions to match against
itemToMatch string the string to match
noOfMatchedCharacters int out parameter that returns the number of characters that was actually matched
Результат bool