C# Class Summer.Batch.Extra.Utils.StringUtils

String helper.
Show file Open project: SummerBatch/SummerBatch

Public Properties

Property Type Description
LIBELLE_DATE_FORMAT string
NO_SEPARATOR_SHORT_DATE_FORMAT string
STANDARD_DATE_FORMAT string
STANDARD_HOUR_DATE_FORMAT string
STANDARD_HOUR_DATE_FORMAT_FILE string
STANDARD_HOUR_DATE_FORMAT_LETTRE string
TIRET_DATE_FORMAT string
UNDERSCORE_DATE_FORMAT string

Public Methods

Method Description
AreEqual ( string str1, string str2 ) : bool

Check if the given strings are equal.

CharAt ( string str, int position ) : char

Return the char at the given position from the given string.

Chomp ( string str ) : string

Chomp the string.

Chop ( string str ) : string

Chop the string.

CompareTo ( string str1, string str2 ) : int

Compares two strings lexicographically.

CompareToIgnoreCase ( string str1, string str2 ) : int

Compares two strings lexicographically, ignoring case differences.

Concat ( string str1, string str2 ) : string

Concat two strings.

Contains ( string str, char searchChar ) : bool

Check if the given string contains the given character.

Contains ( string str, string searchStr ) : bool

Check if the given string contains the given search string.

ConvertIntegerTostring ( int input ) : string

Convert the given int to string.

ConvertIntegerTostring ( int input, int size ) : string

Convert the given int to string of the given size.

EqualsIgnoreCase ( string str1, string str2 ) : bool

Check if the given strings are equal, ignoring case.

Format ( string format, object argument ) : string

Returns a formatted string using the specified format string, and arguments.

GetBytes ( string str ) : byte[]

Encodes this string into a sequence of bytes using the named charset, storing the result into a new byte array.

IndexOf ( string str, char searchChar ) : int

Return the index of the first occurence of the given character in the given string.

IsAlpha ( string str ) : bool

Check if the given string only contains unicode letters.

IsAlphaSpace ( string str ) : bool

Check if the given string only contains letters.

IsAlphanumeric ( string str ) : bool

Check if the given string only contains letters or digits.

IsAlphanumericSpace ( string str ) : bool

Check if the given string only contains letters, digits or spaces.

IsBlank ( string str ) : bool

Check if the given string is blank.

IsDate ( string sDate ) : bool

Check is the given string matches a valid date.

IsDouble ( string chaine ) : bool

Check if the string matches a double value.

IsEmpty ( string str ) : bool

Check if the given string is empty.

IsInteger ( string chaine ) : bool

Check if the string matches a int value.

IsNotBlank ( string str ) : bool

Check if the given string is not blank.

IsNotEmpty ( string str ) : bool

Check if the given string is not empty.

IsNumeric ( string str ) : bool

Check if the given string only contains digits.

IsNumericSpace ( string str ) : bool

Check if the given string only contains digits or spaces.

IsValidEmailAddress ( string mail ) : bool

Check if the given string is a valid email address.

IsWhitespace ( string str ) : bool

Check if the given string only contains whitespaces.

LastIndexOf ( string str, char searchChar ) : int

Return the index of the last occurence of the given character in the given string.

Length ( string str ) : int

Return the length of the given string.

LowerCase ( string str ) : string

Return the given string with lower case charaters only.

Matches ( string str, string regexp ) : bool

Check if the givenstring matches the given regex.

Repeat ( string str, int repeat ) : string

Return a string made of the given string repeated n times.

Replace ( string str, char oldChar, char newChar ) : string

Replace every occurrence of the given character by the new one, in the given string.

Replace ( string str, string searchstring, string replacement ) : string

Replace every occurence of a given searched string by the replacement one, in the given string.

ReplaceAll ( string str, string regex, string replacement ) : string

Replace every occurence of the given string matching the given regex, by the replacement string.

ReplaceFirst ( string str, string regex, string replacement ) : string

Replace the first occurence of the given string matching the given regex, by the replacement string.

Reverse ( string str ) : string

Reverse the given string.

Split ( string str, string regex ) : string[]

Split the given string at avery occurence of given regex and return an array of splitted strings.

Strip ( string str ) : string

Strip the string.

StripEnd ( string str, string stripChars ) : string

Strip the given string.

Substring ( string str, int start ) : string

Substring the given string from the given start position.

Substring ( string str, int start, int length ) : string

Substring the given string from the given start position to position plus the given lenght.

SubstringAfter ( string str, string separator ) : string

Gets the substring after the first occurrence of a separator. The separator is not returned.

SubstringBefore ( string str, string separator ) : string

Gets the substring before the first occurrence of a separator. The separator is not returned.

ToCharArray ( string str ) : char[]

Return an array of character represention of the given string.

Trim ( string str ) : string

Trim the string.

UpperCase ( string str ) : string

string the upper cased string, null if null string input.

Method Details

AreEqual() public static method

Check if the given strings are equal.
public static AreEqual ( string str1, string str2 ) : bool
str1 string string
str2 string string
return bool

CharAt() public static method

Return the char at the given position from the given string.
public static CharAt ( string str, int position ) : char
str string string
position int int
return char

Chomp() public static method

Chomp the string.
public static Chomp ( string str ) : string
str string string
return string

Chop() public static method

Chop the string.
public static Chop ( string str ) : string
str string string
return string

CompareTo() public static method

Compares two strings lexicographically.
public static CompareTo ( string str1, string str2 ) : int
str1 string string
str2 string string
return int

CompareToIgnoreCase() public static method

Compares two strings lexicographically, ignoring case differences.
public static CompareToIgnoreCase ( string str1, string str2 ) : int
str1 string string
str2 string string
return int

Concat() public static method

Concat two strings.
public static Concat ( string str1, string str2 ) : string
str1 string string
str2 string string
return string

Contains() public static method

Check if the given string contains the given character.
public static Contains ( string str, char searchChar ) : bool
str string string
searchChar char char
return bool

Contains() public static method

Check if the given string contains the given search string.
public static Contains ( string str, string searchStr ) : bool
str string string
searchStr string string
return bool

ConvertIntegerTostring() public static method

Convert the given int to string.
public static ConvertIntegerTostring ( int input ) : string
input int int?
return string

ConvertIntegerTostring() public static method

Convert the given int to string of the given size.
public static ConvertIntegerTostring ( int input, int size ) : string
input int int?
size int int?
return string

EqualsIgnoreCase() public static method

Check if the given strings are equal, ignoring case.
public static EqualsIgnoreCase ( string str1, string str2 ) : bool
str1 string string
str2 string string
return bool

Format() public static method

Returns a formatted string using the specified format string, and arguments.
public static Format ( string format, object argument ) : string
format string string
argument object object
return string

GetBytes() public static method

Encodes this string into a sequence of bytes using the named charset, storing the result into a new byte array.
public static GetBytes ( string str ) : byte[]
str string string
return byte[]

IndexOf() public static method

Return the index of the first occurence of the given character in the given string.
public static IndexOf ( string str, char searchChar ) : int
str string string
searchChar char char
return int

IsAlpha() public static method

Check if the given string only contains unicode letters.
public static IsAlpha ( string str ) : bool
str string string
return bool

IsAlphaSpace() public static method

Check if the given string only contains letters.
public static IsAlphaSpace ( string str ) : bool
str string string
return bool

IsAlphanumeric() public static method

Check if the given string only contains letters or digits.
public static IsAlphanumeric ( string str ) : bool
str string string
return bool

IsAlphanumericSpace() public static method

Check if the given string only contains letters, digits or spaces.
public static IsAlphanumericSpace ( string str ) : bool
str string string
return bool

IsBlank() public static method

Check if the given string is blank.
public static IsBlank ( string str ) : bool
str string string
return bool

IsDate() public static method

Check is the given string matches a valid date.
public static IsDate ( string sDate ) : bool
sDate string string
return bool

IsDouble() public static method

Check if the string matches a double value.
public static IsDouble ( string chaine ) : bool
chaine string string
return bool

IsEmpty() public static method

Check if the given string is empty.
public static IsEmpty ( string str ) : bool
str string string
return bool

IsInteger() public static method

Check if the string matches a int value.
public static IsInteger ( string chaine ) : bool
chaine string string
return bool

IsNotBlank() public static method

Check if the given string is not blank.
public static IsNotBlank ( string str ) : bool
str string string
return bool

IsNotEmpty() public static method

Check if the given string is not empty.
public static IsNotEmpty ( string str ) : bool
str string string
return bool

IsNumeric() public static method

Check if the given string only contains digits.
public static IsNumeric ( string str ) : bool
str string string
return bool

IsNumericSpace() public static method

Check if the given string only contains digits or spaces.
public static IsNumericSpace ( string str ) : bool
str string string
return bool

IsValidEmailAddress() public static method

Check if the given string is a valid email address.
public static IsValidEmailAddress ( string mail ) : bool
mail string string
return bool

IsWhitespace() public static method

Check if the given string only contains whitespaces.
public static IsWhitespace ( string str ) : bool
str string string
return bool

LastIndexOf() public static method

Return the index of the last occurence of the given character in the given string.
public static LastIndexOf ( string str, char searchChar ) : int
str string string
searchChar char char
return int

Length() public static method

Return the length of the given string.
public static Length ( string str ) : int
str string string
return int

LowerCase() public static method

Return the given string with lower case charaters only.
public static LowerCase ( string str ) : string
str string string
return string

Matches() public static method

Check if the givenstring matches the given regex.
public static Matches ( string str, string regexp ) : bool
str string string
regexp string string
return bool

Repeat() public static method

Return a string made of the given string repeated n times.
public static Repeat ( string str, int repeat ) : string
str string string
repeat int int
return string

Replace() public static method

Replace every occurrence of the given character by the new one, in the given string.
public static Replace ( string str, char oldChar, char newChar ) : string
str string string
oldChar char char
newChar char char
return string

Replace() public static method

Replace every occurence of a given searched string by the replacement one, in the given string.
public static Replace ( string str, string searchstring, string replacement ) : string
str string string
searchstring string string
replacement string string
return string

ReplaceAll() public static method

Replace every occurence of the given string matching the given regex, by the replacement string.
public static ReplaceAll ( string str, string regex, string replacement ) : string
str string string
regex string string
replacement string string
return string

ReplaceFirst() public static method

Replace the first occurence of the given string matching the given regex, by the replacement string.
public static ReplaceFirst ( string str, string regex, string replacement ) : string
str string str
regex string regex
replacement string replacement
return string

Reverse() public static method

Reverse the given string.
public static Reverse ( string str ) : string
str string string
return string

Split() public static method

Split the given string at avery occurence of given regex and return an array of splitted strings.
public static Split ( string str, string regex ) : string[]
str string str
regex string regex
return string[]

Strip() public static method

Strip the string.
public static Strip ( string str ) : string
str string string
return string

StripEnd() public static method

Strip the given string.
public static StripEnd ( string str, string stripChars ) : string
str string string
stripChars string string
return string

Substring() public static method

Substring the given string from the given start position.
public static Substring ( string str, int start ) : string
str string string
start int int
return string

Substring() public static method

Substring the given string from the given start position to position plus the given lenght.
public static Substring ( string str, int start, int length ) : string
str string string
start int int
length int int
return string

SubstringAfter() public static method

Gets the substring after the first occurrence of a separator. The separator is not returned.
public static SubstringAfter ( string str, string separator ) : string
str string string
separator string string
return string

SubstringBefore() public static method

Gets the substring before the first occurrence of a separator. The separator is not returned.
public static SubstringBefore ( string str, string separator ) : string
str string string
separator string string
return string

ToCharArray() public static method

Return an array of character represention of the given string.
public static ToCharArray ( string str ) : char[]
str string string
return char[]

Trim() public static method

Trim the string.
public static Trim ( string str ) : string
str string string
return string

UpperCase() public static method

string the upper cased string, null if null string input.
public static UpperCase ( string str ) : string
str string
return string

Property Details

LIBELLE_DATE_FORMAT public static property

public static string LIBELLE_DATE_FORMAT
return string

NO_SEPARATOR_SHORT_DATE_FORMAT public static property

public static string NO_SEPARATOR_SHORT_DATE_FORMAT
return string

STANDARD_DATE_FORMAT public static property

public static string STANDARD_DATE_FORMAT
return string

STANDARD_HOUR_DATE_FORMAT public static property

public static string STANDARD_HOUR_DATE_FORMAT
return string

STANDARD_HOUR_DATE_FORMAT_FILE public static property

public static string STANDARD_HOUR_DATE_FORMAT_FILE
return string

STANDARD_HOUR_DATE_FORMAT_LETTRE public static property

public static string STANDARD_HOUR_DATE_FORMAT_LETTRE
return string

TIRET_DATE_FORMAT public static property

public static string TIRET_DATE_FORMAT
return string

UNDERSCORE_DATE_FORMAT public static property

public static string UNDERSCORE_DATE_FORMAT
return string