C# Class EnergyTrading.Extensions.StringExtensions

Afficher le fichier Open project: RWE-Nexus/EnergyTrading-Core

Méthodes publiques

Méthode Description
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

Method Details

AppendValueToEndIfMissing() public static méthode

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
Résultat string

DefaultIfNullOrEmpty() public static méthode

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
Résultat string

Matches() public static méthode

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
Résultat bool

Matches() public static méthode

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
Résultat bool