Summer.Batch.Extra.Utils.StringUtils Class Reference

String helper. More...

Static Public Member Functions

static string Concat (string str1, string str2)
 Concat two strings. More...
 
static bool IsValidEmailAddress (string mail)
 Check if the given string is a valid email address. More...
 
static bool IsDate (string sDate)
 Check is the given string matches a valid date. More...
 
static bool IsDouble (string chaine)
 Check if the string matches a double value. More...
 
static bool IsInteger (string chaine)
 Check if the string matches a int value. More...
 
static char CharAt (string str, int position)
 Return the char at the given position from the given string. More...
 
static int CompareTo (string str1, string str2)
 Compares two strings lexicographically. More...
 
static int CompareToIgnoreCase (string str1, string str2)
 Compares two strings lexicographically, ignoring case differences. More...
 
static byte[] GetBytes (string str)
 Encodes this string into a sequence of bytes using the named charset, storing the result into a new byte array. More...
 
static int Length (string str)
 Return the length of the given string. More...
 
static bool Matches (string str, string regexp)
 Check if the givenstring matches the given regex. More...
 
static string Replace (string str, char oldChar, char newChar)
 Replace every occurrence of the given character by the new one, in the given string. More...
 
static string Replace (string str, string searchstring, string replacement)
 Replace every occurence of a given searched string by the replacement one, in the given string. More...
 
static string ReplaceAll (string str, string regex, string replacement)
 Replace every occurence of the given string matching the given regex, by the replacement string. More...
 
static string ReplaceFirst (string str, string regex, string replacement)
 Replace the first occurence of the given string matching the given regex, by the replacement string. More...
 
static string[] Split (string str, string regex)
 Split the given string at avery occurence of given regex and return an array of splitted strings. More...
 
static char[] ToCharArray (string str)
 Return an array of character represention of the given string. More...
 
static string ConvertIntegerTostring (int?input, int?size)
 Convert the given int to string of the given size. More...
 
static string ConvertIntegerTostring (int?input)
 Convert the given int to string. More...
 
static bool IsEmpty (string str)
 Check if the given string is empty. More...
 
static bool IsNotEmpty (string str)
 Check if the given string is not empty. More...
 
static bool IsBlank (string str)
 Check if the given string is blank. More...
 
static bool IsNotBlank (string str)
 Check if the given string is not blank. More...
 
static string Trim (string str)
 Trim the string. More...
 
static string Strip (string str)
 Strip the string. More...
 
static bool AreEqual (string str1, string str2)
 Check if the given strings are equal. More...
 
static bool EqualsIgnoreCase (string str1, string str2)
 Check if the given strings are equal, ignoring case. More...
 
static int IndexOf (string str, char searchChar)
 Return the index of the first occurence of the given character in the given string. More...
 
static int LastIndexOf (string str, char searchChar)
 Return the index of the last occurence of the given character in the given string. More...
 
static bool Contains (string str, char searchChar)
 Check if the given string contains the given character. More...
 
static bool Contains (string str, string searchStr)
 Check if the given string contains the given search string. More...
 
static string Substring (string str, int start)
 Substring the given string from the given start position. More...
 
static string Substring (string str, int start, int length)
 Substring the given string from the given start position to position plus the given lenght. More...
 
static string Chomp (string str)
 Chomp the string. More...
 
static string Chop (string str)
 Chop the string. More...
 
static string Repeat (string str, int repeat)
 Return a string made of the given string repeated n times. More...
 
static string UpperCase (string str)
 
Parameters
strstring
Returns
the upper cased string, null if null string input.
More...
 
static string LowerCase (string str)
 Return the given string with lower case charaters only. More...
 
static bool IsAlpha (string str)
 Check if the given string only contains unicode letters. More...
 
static bool IsAlphaSpace (string str)
 Check if the given string only contains letters. More...
 
static bool IsAlphanumeric (string str)
 Check if the given string only contains letters or digits. More...
 
static bool IsAlphanumericSpace (string str)
 Check if the given string only contains letters, digits or spaces. More...
 
static bool IsNumeric (string str)
 Check if the given string only contains digits. More...
 
static bool IsNumericSpace (string str)
 Check if the given string only contains digits or spaces. More...
 
static bool IsWhitespace (string str)
 Check if the given string only contains whitespaces. More...
 
static string Reverse (string str)
 Reverse the given string. More...
 
static string StripEnd (string str, string stripChars)
 Strip the given string. More...
 
static string Format (string format, object[] argument)
 Returns a formatted string using the specified format string, and arguments. More...
 
static string SubstringBefore (string str, string separator)
 Gets the substring before the first occurrence of a separator. The separator is not returned. More...
 
static string SubstringAfter (string str, string separator)
 Gets the substring after the first occurrence of a separator. The separator is not returned. More...
 

Static Public Attributes

static readonly string STANDARD_DATE_FORMAT = "dd/MM/yyyy"
 STANDARD_DATE_FORMAT.
 
static readonly string NO_SEPARATOR_SHORT_DATE_FORMAT = "ddMMyy"
 NO_SEPARATOR_SHORT_DATE_FORMAT.
 
static readonly string LIBELLE_DATE_FORMAT = "dd MMMMMMMMM yyyy"
 LIBELLE_DATE_FORMAT.
 
static readonly string UNDERSCORE_DATE_FORMAT = "dd_MM_yyyy"
 UNDERSCORE_DATE_FORMAT.
 
static readonly string TIRET_DATE_FORMAT = "dd-MM-yyyy"
 TIRET_DATE_FORMAT.
 
static readonly string STANDARD_HOUR_DATE_FORMAT = "dd/MM/yyyy HH:mm"
 STANDARD_HOUR_DATE_FORMAT.
 
static readonly string STANDARD_HOUR_DATE_FORMAT_LETTRE = "dd/MM/yyyy HH'h'mm"
 STANDARD_HOUR_DATE_FORMAT_LETTRE.
 
static readonly string STANDARD_HOUR_DATE_FORMAT_FILE = "dd_MM_yyyy_HH'h'mm'm'ss"
 STANDARD_HOUR_DATE_FORMAT_FILE.
 

Detailed Description

String helper.

Member Function Documentation

static bool Summer.Batch.Extra.Utils.StringUtils.AreEqual ( string  str1,
string  str2 
)
static

Check if the given strings are equal.

Parameters
str1string
str2string
Returns
true if the strings are equal, case sensitive, or both null.
static char Summer.Batch.Extra.Utils.StringUtils.CharAt ( string  str,
int  position 
)
static

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

Parameters
strstring
positionint
Returns
the character at the specified index of this string. The first character is at index 0.
static string Summer.Batch.Extra.Utils.StringUtils.Chomp ( string  str)
static

Chomp the string.

Parameters
strstring
Returns
string without newline, null if null string input.
static string Summer.Batch.Extra.Utils.StringUtils.Chop ( string  str)
static

Chop the string.

Parameters
strstring
Returns
string without last character, null if null string input.
static int Summer.Batch.Extra.Utils.StringUtils.CompareTo ( string  str1,
string  str2 
)
static

Compares two strings lexicographically.

Parameters
str1string
str2string
Returns
the value 0 if the argument str2 is equal to str1; a value less than 0 if str1 is lexicographically less than str2; and a value greater than 0 if str1 is lexicographically greater than str2.
static int Summer.Batch.Extra.Utils.StringUtils.CompareToIgnoreCase ( string  str1,
string  str2 
)
static

Compares two strings lexicographically, ignoring case differences.

Parameters
str1string
str2string
Returns
the value 0 if the argument str2 is equal to str1; a value less than 0 if str1 is lexicographically less than str2; and a value greater than 0 if str1 is lexicographically greater than str2.
static string Summer.Batch.Extra.Utils.StringUtils.Concat ( string  str1,
string  str2 
)
static

Concat two strings.

Parameters
str1string
str2string
Returns
the string that is a concatenation of str1 and str2, handling null parameters ("abc"+null="abc").
static bool Summer.Batch.Extra.Utils.StringUtils.Contains ( string  str,
char  searchChar 
)
static

Check if the given string contains the given character.

Parameters
strstring
searchCharchar
Returns
true if the string contains the search character, false if not or null string input.
static bool Summer.Batch.Extra.Utils.StringUtils.Contains ( string  str,
string  searchStr 
)
static

Check if the given string contains the given search string.

Parameters
strstring
searchStrstring
Returns
true if the string contains the search string, false if not or null string input.
static string Summer.Batch.Extra.Utils.StringUtils.ConvertIntegerTostring ( int?  input,
int?  size 
)
static

Convert the given int to string of the given size.

Parameters
inputint?
sizeint?
Returns
if size is not nul a new string left padded with zeros until the size of the crafted string is e, if size is null the tostring value.
static string Summer.Batch.Extra.Utils.StringUtils.ConvertIntegerTostring ( int?  input)
static

Convert the given int to string.

Parameters
inputint?
Returns
the tostring value of the Integer parameter if not null, "" otherwise.
static bool Summer.Batch.Extra.Utils.StringUtils.EqualsIgnoreCase ( string  str1,
string  str2 
)
static

Check if the given strings are equal, ignoring case.

Parameters
str1string
str2string
Returns
true if the strings are equal, case insensitive, or both null.
static string Summer.Batch.Extra.Utils.StringUtils.Format ( string  format,
object[]  argument 
)
static

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

Parameters
formatstring
argumentobject
Returns
A formatted string.
static byte [] Summer.Batch.Extra.Utils.StringUtils.GetBytes ( string  str)
static

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

Parameters
strstring
Returns
the resultant byte array.
static int Summer.Batch.Extra.Utils.StringUtils.IndexOf ( string  str,
char  searchChar 
)
static

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

Parameters
strstring
searchCharchar
Returns
the first index of the search character, -1 if no match or null string input.
static bool Summer.Batch.Extra.Utils.StringUtils.IsAlpha ( string  str)
static

Check if the given string only contains unicode letters.

Parameters
strstring

str string

Returns
true if the string only contains unicode letters.
static bool Summer.Batch.Extra.Utils.StringUtils.IsAlphanumeric ( string  str)
static

Check if the given string only contains letters or digits.

Parameters
strstring
Returns
true if only contains letters or digits, and is non-null.
static bool Summer.Batch.Extra.Utils.StringUtils.IsAlphanumericSpace ( string  str)
static

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

Parameters
strstring
Returns
true if only contains letters, digits or spaces, and is non-null.
static bool Summer.Batch.Extra.Utils.StringUtils.IsAlphaSpace ( string  str)
static

Check if the given string only contains letters.

Parameters
strstring
Returns
true if only contains letters, and is non-null.
static bool Summer.Batch.Extra.Utils.StringUtils.IsBlank ( string  str)
static

Check if the given string is blank.

Parameters
strstring
Returns
true if the string is null, empty or whitespace.
static bool Summer.Batch.Extra.Utils.StringUtils.IsDate ( string  sDate)
static

Check is the given string matches a valid date.

Parameters
sDatestring
Returns
true if string matches "dd/MM/yyyy" and is a valid date (ex : 31/02/2012 forbidden).
static bool Summer.Batch.Extra.Utils.StringUtils.IsDouble ( string  chaine)
static

Check if the string matches a double value.

Parameters
chainestring
Returns
true if string matches a double value.
static bool Summer.Batch.Extra.Utils.StringUtils.IsEmpty ( string  str)
static

Check if the given string is empty.

Parameters
strstring
Returns
true if the string is empty or null.
static bool Summer.Batch.Extra.Utils.StringUtils.IsInteger ( string  chaine)
static

Check if the string matches a int value.

Parameters
chainestring
Returns
true if string matches an int value.
static bool Summer.Batch.Extra.Utils.StringUtils.IsNotBlank ( string  str)
static

Check if the given string is not blank.

Parameters
strstring
Returns
true if the string is not null, not empty and not whitespace.
static bool Summer.Batch.Extra.Utils.StringUtils.IsNotEmpty ( string  str)
static

Check if the given string is not empty.

Parameters
strstring
Returns
true if the string is not empty and not null.
static bool Summer.Batch.Extra.Utils.StringUtils.IsNumeric ( string  str)
static

Check if the given string only contains digits.

Parameters
strstring
Returns
true if only contains digits, and is non-null.
static bool Summer.Batch.Extra.Utils.StringUtils.IsNumericSpace ( string  str)
static

Check if the given string only contains digits or spaces.

Parameters
strstring
Returns
true if only contains digits or spaces, and is non-null.
static bool Summer.Batch.Extra.Utils.StringUtils.IsValidEmailAddress ( string  mail)
static

Check if the given string is a valid email address.

Parameters
mailstring
Returns
true if string matches format XX@XX.nosp@m..XX.
static bool Summer.Batch.Extra.Utils.StringUtils.IsWhitespace ( string  str)
static

Check if the given string only contains whitespaces.

Parameters
strstring
Returns
true if only contains whitespaces, and is non-null.
static int Summer.Batch.Extra.Utils.StringUtils.LastIndexOf ( string  str,
char  searchChar 
)
static

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

Parameters
strstring
searchCharchar
Returns
the last index of the search character, -1 if no match or null string input.
static int Summer.Batch.Extra.Utils.StringUtils.Length ( string  str)
static

Return the length of the given string.

Parameters
strstring
Returns
the length of this string.
static string Summer.Batch.Extra.Utils.StringUtils.LowerCase ( string  str)
static

Return the given string with lower case charaters only.

Parameters
strstring
Returns
the lower cased string, null if null string input.
static bool Summer.Batch.Extra.Utils.StringUtils.Matches ( string  str,
string  regexp 
)
static

Check if the givenstring matches the given regex.

Parameters
strstring
regexpstring
Returns
true if str matches regexp. Otherwise false.
static string Summer.Batch.Extra.Utils.StringUtils.Repeat ( string  str,
int  repeat 
)
static

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

Parameters
strstring
repeatint
Returns
a new string consisting of the original string repeated n times, null if null string input.
static string Summer.Batch.Extra.Utils.StringUtils.Replace ( string  str,
char  oldChar,
char  newChar 
)
static

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

Parameters
strstring
oldCharchar
newCharchar
Returns
a string derived from this string by replacing every occurrence of oldChar with newChar.
static string Summer.Batch.Extra.Utils.StringUtils.Replace ( string  str,
string  searchstring,
string  replacement 
)
static

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

Parameters
strstring
searchstringstring
replacementstring
Returns
the string with any replacements processed, null if null string input.
static string Summer.Batch.Extra.Utils.StringUtils.ReplaceAll ( string  str,
string  regex,
string  replacement 
)
static

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

Parameters
strstring
regexstring
replacementstring
Returns
a string derived from this string by replacing every occurrence of regexp with replacement parameter.
static string Summer.Batch.Extra.Utils.StringUtils.ReplaceFirst ( string  str,
string  regex,
string  replacement 
)
static

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

Parameters
strstr
regexregex
replacementreplacement
Returns
a string derived from this string by replacing the first occurrence of regexp with replacement parameter.
static string Summer.Batch.Extra.Utils.StringUtils.Reverse ( string  str)
static

Reverse the given string.

Parameters
strstring
Returns
the reversed string, null if null string input.
static string [] Summer.Batch.Extra.Utils.StringUtils.Split ( string  str,
string  regex 
)
static

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

Parameters
strstr
regexregex
Returns
the array of strings computed by splitting this string around matches of the given regular expression.
static string Summer.Batch.Extra.Utils.StringUtils.Strip ( string  str)
static

Strip the string.

Parameters
strstring
Returns
the stripped string, null if null string input.
static string Summer.Batch.Extra.Utils.StringUtils.StripEnd ( string  str,
string  stripChars 
)
static

Strip the given string.

Parameters
strstring
stripCharsstring
Returns
the stripped string, null if null string input.
static string Summer.Batch.Extra.Utils.StringUtils.Substring ( string  str,
int  start 
)
static

Substring the given string from the given start position.

Parameters
strstring
startint
Returns
substring from start position, null if null string input. A negative start position can be used to start n characters from the end of the string.
static string Summer.Batch.Extra.Utils.StringUtils.Substring ( string  str,
int  start,
int  length 
)
static

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

Parameters
strstring
startint
lengthint
Returns
substring from start position to start position plus length, null if null string input.
static string Summer.Batch.Extra.Utils.StringUtils.SubstringAfter ( string  str,
string  separator 
)
static

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

Parameters
strstring
separatorstring
Returns
the substring after the first occurrence of the separator, null if null string input.
static string Summer.Batch.Extra.Utils.StringUtils.SubstringBefore ( string  str,
string  separator 
)
static

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

Parameters
strstring
separatorstring
Returns
the substring before the first occurrence of the separator, null if null string input.
static char [] Summer.Batch.Extra.Utils.StringUtils.ToCharArray ( string  str)
static

Return an array of character represention of the given string.

Parameters
strstring
Returns
a newly allocated character array whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.
static string Summer.Batch.Extra.Utils.StringUtils.Trim ( string  str)
static

Trim the string.

Parameters
strstring
Returns
the trimmed string, null if null string input.
static string Summer.Batch.Extra.Utils.StringUtils.UpperCase ( string  str)
static

Parameters
strstring
Returns
the upper cased string, null if null string input.


The documentation for this class was generated from the following file:
  • Summer.Batch.Extra/Utils/StringUtils.cs