C# Class Material.EBDeployer.DeployLogic.Extensions.StringExtensions

Exibir arquivo Open project: MaterialDev/elastic-beanstalk-deploy

Public Methods

Method Description
Clean ( this str, List oldValues, string newValue ) : string

Given a list of values to replace, it looks them up and replaces them with the newValue.

Contains ( this source, string toCheck, System.StringComparison comparison ) : bool
DoubleParseOrDefault ( this doubleString, double defaultValue ) : double

Attempts to parse a string into an Double value, if the parse is not successful, then the given defaultValue is returned.

EmptyToNull ( this value ) : string
Int32ParseOrDefault ( this intString, int defaultValue ) : int

Attempts to parse a string into an Int32 value, if the parse is not successful, then the given defaultValue is returned.

IsEqualIgnoreCase ( this s1, string s2 ) : bool

Checks if the two strings are equal ignoring casing.

Split ( this input, string separator ) : IEnumerable
Trim ( this inputs, char trimCharacters = null ) : IEnumerable
TrimEnd ( this source, string value ) : string

Removes the string value from the end of the source string iff the source string ends with the value string.

Truncate ( this value, int length ) : string

Truncates a string to the supplied length if the current length of the string exceeds the given length parameter.

Method Details

Clean() public static method

Given a list of values to replace, it looks them up and replaces them with the newValue.
public static Clean ( this str, List oldValues, string newValue ) : string
str this
oldValues List List of old values to replace
newValue string Value that will replace each occurance of the old values.
return string

Contains() public static method

public static Contains ( this source, string toCheck, System.StringComparison comparison ) : bool
source this
toCheck string
comparison System.StringComparison
return bool

DoubleParseOrDefault() public static method

Attempts to parse a string into an Double value, if the parse is not successful, then the given defaultValue is returned.
public static DoubleParseOrDefault ( this doubleString, double defaultValue ) : double
doubleString this String that will be parsed
defaultValue double Value that is returned if string is not parsable
return double

EmptyToNull() public static method

public static EmptyToNull ( this value ) : string
value this
return string

Int32ParseOrDefault() public static method

Attempts to parse a string into an Int32 value, if the parse is not successful, then the given defaultValue is returned.
public static Int32ParseOrDefault ( this intString, int defaultValue ) : int
intString this String that will be parsed
defaultValue int Value that is returned if string is not parsable
return int

IsEqualIgnoreCase() public static method

Checks if the two strings are equal ignoring casing.
public static IsEqualIgnoreCase ( this s1, string s2 ) : bool
s1 this
s2 string
return bool

Split() public static method

public static Split ( this input, string separator ) : IEnumerable
input this
separator string
return IEnumerable

Trim() public static method

public static Trim ( this inputs, char trimCharacters = null ) : IEnumerable
inputs this
trimCharacters char
return IEnumerable

TrimEnd() public static method

Removes the string value from the end of the source string iff the source string ends with the value string.
public static TrimEnd ( this source, string value ) : string
source this
value string
return string

Truncate() public static method

Truncates a string to the supplied length if the current length of the string exceeds the given length parameter.
Thrown when value is null.
public static Truncate ( this value, int length ) : string
value this A string.
length int The number of characters to truncate the string at.
return string