Ultimate.Utilities.Docs
Ultimate.Utilities.StringUtils Class Reference

Utility methods for String operations. All methods in the StringUtils are Null safe. More...

Static Public Member Functions

static bool IsEmpty (string str)
 Checks If a String is Empty ("") or Null More...
 
static bool IsNotEmpty (string str)
 Checks If a String is Not Empty ("") and Not Null More...
 
static bool IsAnyEmpty (params string[] strArgs)
 Checks if any of the Strings are Empty ("") or Null More...
 
static bool IsNoneEmpty (params string[] strArgs)
 Checks if None of the Strings are Empty ("") and Null More...
 
static bool IsBlank (string str)
 Checks if a String is Empty (""),Null or Whitespace (" ") More...
 
static bool IsNotBlank (string str)
 Checks if a String is Not Empty (""),Not Null and Not Whitespace (" ") More...
 
static bool IsAnyBlank (params string[] strArgs)
 Checks if any of the Strings are Empty (""),Null or Whitespace (" ") More...
 
static bool IsNoneBlank (params string[] strArgs)
 
static string Trim (string str)
 Removes control characters from both ends of the String. Handles null by returning null. More...
 
static string TrimToNull (string str)
 Removes control characters from both ends of the String by returning null if the String is Empty ("") after the trim or null More...
 
static string TrimToEmpty (string str)
 Removes control characters from both ends of the String by returning Empty String ("") if the String is Empty ("") after the trim or null More...
 
static string StripStart (string str, string stripChars=null)
 Strips whitespace or the given set of chars at the starting of a String More...
 
static string StripEnd (string str, string stripChars=null)
 Strips whitespace or the given set of chars at the ending of a String More...
 
static string Strip (string str, string stripChars=null)
 Strips whitespace or the given set of chars from the start and end of a String More...
 
static string StripToNull (string str)
 Strips whitespace from the start and end of a String and returns Null if the result is Empty (""). More...
 
static string StripToEmpty (string str)
 Strips whitespace from the start and end of a String. Returns Empty ("") if the input is Null. More...
 
static string[] StripAll (params string[] strs)
 Strips whitespace from the start and end of every String in an array. More...
 
static string[] StripAll (string[] strs, string stripChars=null)
 Strips the given set of Chars from the start and end of every string in an array. More...
 
static string StripAccents (string input)
 Removes diacritics (~= accents) from a string. The case will not be altered More...
 
static bool Equals (string s1, string s2)
 Compares two strings and returns true if they represent equal sequence of characters. More...
 
static bool EqualsIgnoreCase (string s1, string s2)
 Compares two strings by ignoring case and returns true if they represent equal sequence of characters. More...
 
static int IndexOf (string s1, char searchValue, int startPos=0)
 Finds the first index of the given character within a string. More...
 
static int IndexOf (string s1, string searchValue, int startPos=0)
 Finds the first index of the given string within a string. More...
 
static int IndexOfIgnoreCase (string s1, string searchValue, int startPos=0)
 Finds the first index of the given string within a string by ignoring case. More...
 
static int IndexOfIgnoreCase (string s1, char searchValue, int startPos=0)
 Finds the first index of the given character within a string by ignoring case. More...
 
static int LastIndexOf (string s1, string searchValue, int?startPos=null)
 Finds the last index of the given string within a string. More...
 
static int LastIndexOf (string s1, char searchValue, int?startPos=null)
 Finds the last index of the given char within a string. More...
 
static int LastIndexOfIgnoreCase (string s1, string searchValue, int?startPos=null)
 Finds the last index of the given string within a string.,ignoring case. More...
 
static int LastIndexOfIgnoreCase (string s1, char searchValue, int?startPos=null)
 Finds the last index of the given char within a string.,ignoring case. More...
 
static int OrdinalIndexOf (string str, string searchValue, int ordinal)
 Finds the n-th index of the given string within a string. More...
 
static int OrdinalIndexOf (string str, char searchValue, int ordinal)
 Finds the n-th index of the given char within a string. More...
 
static int LastOrdinalIndexOf (string str, string searchValue, int ordinal)
 Finds the n-th Last index of the given string within a string. More...
 
static int LastOrdinalIndexOf (string str, char searchValue, int ordinal)
 Finds the n-th Last index of the given char within a string. More...
 
static bool Contains (string str, string searchValue)
 Checks if a string conatins the given search string. More...
 
static bool Contains (string str, char searchValue)
 Checks if a string conatins the given search character. More...
 
static bool ContainsIgnoreCase (string str, string searchValue)
 Checks if a string conatins the given search string.,ignoring case More...
 
static bool ContainsIgnoreCase (string str, char searchValue)
 Checks if a string conatins the given search character.,ignoring case More...
 
static bool ContainsWhiteSpace (string str)
 Checks whether a given string contains any Whitespace characters. More...
 
static int IndexOfAny (string str, params char[] searchChars)
 Search a string to find the first index of any character in the given set of search characters. More...
 
static int IndexOfAny (string str, string searchChars)
 Search a string to find the first index of any character in the given set of search characters. More...
 
static bool ContainsAny (string str, params char[] searchChars)
 Checks if the string contains any character from the given set of characters. More...
 
static bool ContainsAny (string str, string searchChars)
 Checks if the string contains any character from the given set of characters. More...
 
static bool ContainsAny (string str, params string[] searchStrings)
 Checks if the string contains any of the strings in the given array. More...
 
static int IndexOfAnyBut (string str, params char[] searchChars)
 Searches a string to find the first index of any character not in the given set of characters. More...
 
static int IndexOfAnyBut (string str, string searchChars)
 Searches a string to find the first index of any character not in the given set of characters. More...
 
static bool ContainsOnly (string str, params char[] searchChars)
 Checks if the string contains only the given set of characters. More...
 
static bool ContainsOnly (string str, string searchChars)
 Checks if the string contains only the given set of characters. More...
 
static bool ContainsNone (string str, params char[] searchChars)
 Checks if the string contains none of the given set of characters. More...
 
static bool ContainsNone (string str, string searchChars)
 Checks if the string contains none of the given set of characters. More...
 
static int IndexOfAny (string str, params string[] searchStrs)
 Searches a string to find the first index of any of the given set of substrings. More...
 
static int LastIndexOfAny (string str, params string[] searchStrs)
 Searches a string to find the last index of any of the given set of substrings. More...
 
static string Substring (string str, int start)
 Gets a substring from the given string without raising exceptions. More...
 
static string Substring (string str, int start, int end)
 Gets a substring from the given string without raising exceptions. More...
 
static string SubstringWithNegatives (string str, int start, int end)
 Gets a substring from the given string without raising exceptions. More...
 
static string Left (string str, int len)
 Gets the left most Characters of string. More...
 
static string Right (string str, int len)
 Gets the right most Characters of string. More...
 
static string Mid (string str, int pos, int len)
 Gets characters from the middle of a string. More...
 
static string SubstringBefore (string str, string separator)
 Gets the substring before the first occurrence of a separator. More...
 
static string SubstringAfter (string str, string separator)
 Gets the substring after the first occurrence of a separator. More...
 
static string SubstringBeforeLast (string str, string separator)
 Gets the substring before the last occurrence of a separator. More...
 
static string SubstringAfterLast (string str, string separator)
 Gets the substring after the last occurrence of a separator. More...
 
static string SubstringBetween (string str, string tag)
 Gets the String that is nested in between two instances of the same String. More...
 
static string SubstringBetween (string str, string open, string close)
 Gets the String that is nested in between two Strings. More...
 
static string[] SubstringsBetween (string str, string open, string close)
 Searches a String for substrings delimited by a start and end tag, returning all matching substrings in an array. More...
 
static string[] Split (string str)
 Splits the given string into an array, using whitespace as the separator. More...
 
static string[] Split (string str, char separatorChar)
 Splits the given string into an array, using the specified separator. More...
 
static string[] Split (string str, string separatorChars)
 Splits the given string into an array, using the specified separators. More...
 
static string[] Split (string str, string separatorChars, int max)
 Splits the given string into an array with max length, using the specified separator string. More...
 
static string[] SplitByWholeSeparator (string str, string separator)
 Splits the provided text into an array, using the specified separator string. More...
 
static string[] SplitByWholeSeparator (string str, string separator, int max)
 Splits the provided text into an array with max length, using the specified separator string. More...
 
static string[] SplitByWholeSeparatorPreserveAllTokens (string str, string separator)
 Splits the provided text into an array, using the specified separator string.Adjacent separators are treated as separators for empty tokens. More...
 
static string[] SplitByWholeSeparatorPreserveAllTokens (string str, string separator, int max)
 Splits the provided text into an array with max length, using the specified separator string.Adjacent separators are treated as separators for empty tokens. More...
 
static string[] SplitPreserveAllTokens (string str)
 Splits the given string into an array, using whitespace as the separator, preserving all tokens, including empty tokens created by adjacent separators. More...
 
static string[] SplitPreserveAllTokens (string str, char separatorChar)
 Splits the provided text into an array, using the specified separator, preserving all tokens, including empty tokens created by adjacent separators. More...
 
static string[] SplitPreserveAllTokens (string str, string separatorChars)
 Splits the provided text into an array, using the specified separator, preserving all tokens, including empty tokens created by adjacent separators. More...
 
static string[] SplitPreserveAllTokens (string str, string separatorChars, int max)
 Splits the provided text into an array with max length, using the specified separator, preserving all tokens, including empty tokens created by adjacent separators. More...
 
static string[] SplitByCharacterType (string str)
 Splits a String by Character type More...
 
static string[] SplitByCharacterTypeCamelCase (string str)
 Splits a String by Character type.the character of CamelCase type , if any, immediately preceding a token of type LowerCase will belong to the following token rather than to the preceding.See the examples. More...
 
static string Join (params string[] elements)
 Joins the elements of the given array into a single String containing the given list of elements. More...
 
static string Join (object[] array, string separator=null)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator. More...
 
static string Join (long[] array, string separator=null)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any. More...
 
static string Join (int[] array, string separator=null)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any. More...
 
static string Join (double[] array, string separator=null)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any. More...
 
static string Join (short[] array, string separator=null)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any. More...
 
static string Join (float[] array, string separator=null)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any. More...
 
static string Join (byte[] array, string separator=null)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any. More...
 
static string Join (char[] array, string separator=null)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any. More...
 
static string Join (object[] array, string separator, int startIndex, int noOfItems)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items. More...
 
static string Join (long[] array, string separator, int startIndex, int noOfItems)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items. More...
 
static string Join (int[] array, string separator, int startIndex, int noOfItems)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items. More...
 
static string Join (short[] array, string separator, int startIndex, int noOfItems)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items. More...
 
static string Join (double[] array, string separator, int startIndex, int noOfItems)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items. More...
 
static string Join (float[] array, string separator, int startIndex, int noOfItems)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items. More...
 
static string Join (byte[] array, string separator, int startIndex, int noOfItems)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items. More...
 
static string Join (char[] array, string separator, int startIndex, int noOfItems)
 Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items. More...
 
static string JoinWith (params object[] objects)
 Joins the elements of the given args into a single String containing the provided elements. More...
 
static string JoinWith (string separator, params object[] objects)
 Joins the elements of the given args into a single String containing the provided elements using the given separator. More...
 
static string DeleteWhitespace (string str)
 Deletes all whitespaces from a String More...
 
static string RemoveStart (string str, string remove)
 Removes a substring only if it is at the beginning of the input string, otherwise returns the original string. More...
 
static string RemoveStartIgnoreCase (string str, string remove)
 By ignoring case.,Removes a substring only if it is at the beginning of the input string , otherwise returns the original string. More...
 
static string RemoveEnd (string str, string remove)
 Removes a substring only if it is at the end of the input string, otherwise returns the original string. More...
 
static string RemoveEndIgnoreCase (string str, string remove)
 By ignoring case.,Removes a substring only if it is at the end of the input string , otherwise returns the original string. More...
 
static string Remove (string str, string remove)
 Removes all occurences of the substring from within the input string. More...
 
static string Remove (string str, char remove)
 Removes all occurences of a character from within the input string. More...
 
static string ReplaceOnce (string text, string searchString, string replacement)
 Replaces a String with another String inside a larger String, once. More...
 
static string ReplacePattern (string source, string regex, string replacement, bool ignoreCase=false)
 Replaces All regular expression matches with another String inside a larger String. More...
 
static string RemovePattern (string source, string regex)
 Removes All regular expression matches inside a larger String. More...
 
static string Replace (string text, string searchString, string replacement)
 Replaces all occurrences of a String within another String. More...
 
static string Replace (string text, string searchString, string replacement, int max)
 Replaces all occurrences of a String within another String.,for the first max values of the search string. More...
 
static string ReplaceEach (string text, string[] searchList, string[] replacementList)
 Replaces all occurrences of Strings within another String. More...
 
static string ReplaceEachRepeatedly (string text, string[] searchList, string[] replacementList)
 Replaces all occurrences of Strings within another String in a repeated way. More...
 
static string ReplaceChars (string str, char searchChar, char replaceChar)
 Replaces all occurrences of a character within another String More...
 
static string ReplaceChars (string str, string searchChars, string replaceChars)
 Replaces multiple characters of a string within another string More...
 
static string Overlay (string str, string overlay, int start, int end)
 Overlays part of a String with another String. More...
 
static string Chomp (string str)
 Removes one newline from end of a String if it's there,otherwise string is unchanged. More...
 
static string Chop (string str)
 Remove the last character from a String. More...
 
static string Repeat (string str, int repeat)
 Repeat a String n times to form a new String. More...
 
static string Repeat (string str, string separator, int repeat)
 Repeat a String n times to form a new String.,with a string separator added in between More...
 
static string Repeat (char ch, int repeat)
 Repeat a character n times to form a new String. More...
 
static string RightPad (string str, int size)
 Right pad a String with spaces (' '). More...
 
static string RightPad (string str, int size, char padChar)
 Right pad a String with a specified character. More...
 
static string RightPad (string str, int size, string padStr)
 Right pad a String with a specified String. More...
 
static string LeftPad (string str, int size)
 Left pad a String with spaces (' '). More...
 
static string LeftPad (string str, int size, char padChar)
 Left pad a String with a specified character. More...
 
static string LeftPad (string str, int size, string padStr)
 Left pad a String with a specified String. More...
 
static int Length (string str)
 Gets the length of a string and returns 0 if incase of null input More...
 
static string Center (string str, int size)
 Centers a String in a larger String of size using space (' ') More...
 
static string Center (string str, int size, char padChar)
 Centers a String in a larger String of size using the given character. More...
 
static string Center (string str, int size, string padStr)
 Centers a String in a larger String of size using the given string. More...
 
static string UpperCase (string str)
 Converts a string to upper case More...
 
static string LowerCase (string str)
 Converts a string to lower case More...
 
static string Capitalize (string str)
 Capitalizes a string by changing the first letter to a title letter More...
 
static string UnCapitalize (string str)
 Uncapitalizes a String, changing the first letter to lower case More...
 
static string SwapCase (string str)
 Swaps the case of a String changing upper and title case to lower case, and lower case to upper case. More...
 
static int CountMatches (string str, string sub)
 Counts how many times the substring appears in the larger string. More...
 
static int CountMatches (string str, char ch)
 Counts how many times a character appears in the larger string. More...
 
static bool IsAlpha (string str)
 Checks if the string contains only Unicode letters More...
 
static bool IsAlphaSpace (string str)
 Checks if the string contains only Unicode letters and space More...
 
static bool IsAlphaNumeric (string str)
 Checks if the string contains only Unicode letters and numbers More...
 
static bool IsAlphaNumericSpace (string str)
 Checks if the string contains only Unicode letters and numbers More...
 
static bool IsAsciiPrintable (string str)
 Checks if the string contains only ASCII printable characters. More...
 
static bool IsNumeric (string str)
 Checks if the string contains only Unicode numbers More...
 
static bool IsNumericSpace (string str)
 Checks if the string contains only Unicode numbers or space More...
 
static bool IsWhiteSpace (string str)
 Checks if the string contains only whitespace More...
 
static bool IsAllLowerCase (string str)
 Checks if the string contains only lowercase letters More...
 
static bool IsAllUpperCase (string str)
 Checks if the string contains only uppercase letters More...
 
static string DefaultString (string str, string defaultStr="")
 Returns either the input string or the default string if the input string is null More...
 
static string DefaultIfBlank (string str, string defaultStr="")
 Returns either the input string or the default string if the input string is blank More...
 
static string DefaultIfEmpty (string str, string defaultStr)
 Returns either the input string or the default string if the input string is Empty More...
 
static string Rotate (string str, int shift)
 Rotate a string of characters More...
 
static string Reverse (string str)
 Reverses a string More...
 
static string ReverseDelimited (string str, char separatorChar)
 Reverses a String that is delimited by a specific character. More...
 
static string Abbreviate (string str, int maxWidth)
 Abbreviates a String using ellipses.For example "Today is a nice day for everyone" will become "Today is a nice..." More...
 
static string Abbreviate (string str, int offset, int maxWidth)
 Abbreviates a String using ellipses.This allows you to specify offset.For example "Today is a nice day for everyone" will become "...is a nice..." More...
 
static string AbbreviateMiddle (string str, string middle, int length)
 Abbreviates a String to the length passed, replacing the middle characters with the given replacement String. More...
 
static string Difference (string str1, string str2)
 Compares two Strings, and returns the part of string where they differ. More...
 
static int IndexOfDifference (string str1, string str2)
 Compares two Strings, and returns the index at which they begin to differ. More...
 
static int IndexOfDifference (params string[] strArray)
 Compares all strings in an array and returns the index at which the strings begin to differ. More...
 
static string GetCommonPrefix (params string[] strs)
 Compares all Strings in an array and returns the initial sequence of characters that is common to all of them. More...
 
static bool StartsWithIgnoreCase (string str, string prefix)
 Checks if a string starts with a specified prefix by ignoring case. More...
 
static bool StartsWith (string str, string prefix, bool ignoreCase=false)
 Checks if a string starts with a specified prefix. More...
 
static bool StartsWithAny (string str, bool ignoreCase, params string[] searchStrings)
 Checks if a string starts with any of an array of specified strings. More...
 
static bool EndsWithIgnoreCase (string str, string suffix)
 Checks if a string ends with a specified suffix by ignoring case. More...
 
static bool EndsWith (string str, string suffix, bool ignoreCase=false)
 Checks if a string ends with a specified suffix. More...
 
static bool EndsWithAny (string str, bool ignoreCase, params string[] searchStrings)
 Checks if a string ends with any of an array of specified strings. More...
 
static string NormalizeSpace (string str)
 Removes leading and trailing whitespaces and replaces sequences of whitespace characters by a single space. More...
 
static string AppendIfMissing (string str, string suffix, bool ignoreCase=false, ICollection< string > suffixes=null)
 Appends the given suffix to the end of the string if the string does not already end with the suffix. More...
 
static string AppendIfMissingIgnoreCase (string str, string suffix, string[] suffixes=null)
 Appends the given suffix to the end of the string if the string does not already end with the suffix. Ignores the casing while searching for the suffix. More...
 
static string PrependIfMissing (string str, string prefix, bool ignoreCase=false, ICollection< string > prefixes=null)
 Prepends the given prefix to the start of the string if the string does not already start with the prefix. More...
 
static string PrependIfMissingIgnoreCase (string str, string prefix, string[] prefixes=null)
 Prepends the given prefix to the start of the string if the string does not already start with the prefix. Ignores the casing while searching for the prefix. More...
 
static string Wrap (string str, char wrapWith)
 Wraps a string with a character. More...
 
static string Wrap (string str, string wrapWith)
 raps a String with the given String. More...
 
static string ToAsciiString (byte[] bytes, bool throwExceptions=false)
 Converts a byte array to a String using the Ascii encoding. More...
 
static string ToBigEndianUnicodeString (byte[] bytes, bool throwExceptions=false)
 Converts a byte array to a String using the BigEndianUnicode encoding. More...
 
static string ToUnicodeString (byte[] bytes, bool throwExceptions=false)
 Converts a byte array to a String using the Unicode encoding. More...
 
static string ToUtf32String (byte[] bytes, bool throwExceptions=false)
 Converts a byte array to a String using the UTF32 encoding. More...
 
static string ToUtf7String (byte[] bytes, bool throwExceptions=false)
 Converts a byte array to a String using the UTF7 encoding. More...
 
static string ToUtf8String (byte[] bytes, bool throwExceptions=false)
 Converts a byte array to a String using the UTF8 encoding. More...
 
static string ToDefaultString (byte[] bytes, bool throwExceptions=false)
 Converts a byte array to a String using the Default encoding. More...
 
static byte[] ToAsciiBytes (string str, bool throwExceptions=false)
 Converts the given string to byte array using the Ascii encoding. More...
 
static byte[] ToBigEndianUnicodeBytes (string str, bool throwExceptions=false)
 Converts the given string to byte array using the BigEndianUnicode encoding. More...
 
static byte[] ToUnicodeBytes (string str, bool throwExceptions=false)
 Converts the given string to byte array using the Unicode encoding. More...
 
static byte[] ToUtf32Bytes (string str, bool throwExceptions=false)
 Converts the given string to byte array using the UTF32 encoding. More...
 
static byte[] ToUtf7Bytes (string str, bool throwExceptions=false)
 Converts the given string to byte array using the UTF7 encoding. More...
 
static byte[] ToUtf8Bytes (string str, bool throwExceptions=false)
 Converts the given string to byte array using the UTF8 encoding. More...
 
static byte[] ToDefaultBytes (string str, bool throwExceptions=false)
 Converts the given string to byte array using the Default encoding. More...
 

Static Public Attributes

static readonly string Space = " "
 Space Character " " More...
 
static readonly string Empty = ""
 Empty string "" More...
 
static readonly char Lf = '\n'
 Line Feed Character '
' More...
 
static readonly char Cr = '\r'
 Carriage Return Character '' More...
 
static readonly int IndexNotFound = -1
 Index Not Found (-1) More...
 

Detailed Description

Utility methods for String operations. All methods in the StringUtils are Null safe.

Member Function Documentation

static string Ultimate.Utilities.StringUtils.Abbreviate ( string  str,
int  maxWidth 
)
static

Abbreviates a String using ellipses.For example "Today is a nice day for everyone" will become "Today is a nice..."

StringUtils.Abbreviate(null, *) = null

StringUtils.Abbreviate("", 4) = ""

StringUtils.Abbreviate("abcdefg", 6) = "abc..."

StringUtils.Abbreviate("abcdefg", 7) = "abcdefg"

StringUtils.Abbreviate("abcdefg", 8) = "abcdefg"

StringUtils.Abbreviate("abcdefg", 4) = "a..."

StringUtils.Abbreviate("abcdefg", 3) = ArgumentException

Parameters
strinput string
maxWidthmaximum length of result String, must be at least 4
Returns
returns abbreviated string or empty if width is less than 4
static string Ultimate.Utilities.StringUtils.Abbreviate ( string  str,
int  offset,
int  maxWidth 
)
static

Abbreviates a String using ellipses.This allows you to specify offset.For example "Today is a nice day for everyone" will become "...is a nice..."

StringUtils.Abbreviate(null, *, *) = null

StringUtils.Abbreviate("", 0, 4) = ""

StringUtils.Abbreviate("abcdefghijklmno", -1, 10) = "abcdefg..."

StringUtils.Abbreviate("abcdefghijklmno", 0, 10) = "abcdefg..."

StringUtils.Abbreviate("abcdefghijklmno", 1, 10) = "abcdefg..."

StringUtils.Abbreviate("abcdefghijklmno", 4, 10) = "abcdefg..."

StringUtils.Abbreviate("abcdefghijklmno", 5, 10) = "...fghi..."

StringUtils.Abbreviate("abcdefghijklmno", 6, 10) = "...ghij..."

StringUtils.Abbreviate("abcdefghijklmno", 8, 10) = "...ijklmno"

StringUtils.Abbreviate("abcdefghijklmno", 10, 10) = "...ijklmno"

StringUtils.Abbreviate("abcdefghijklmno", 12, 10) = "...ijklmno"

StringUtils.Abbreviate("abcdefghij", 0, 3) = ArgumentException

StringUtils.Abbreviate("abcdefghij", 5, 6) = ArgumentException

Parameters
strinput string
offsetoffset length to be used on the left edge of string
maxWidthmaximum length of result String, must be at least 4 (should be atleast 7 if offset is used).
Returns
returns abbreviated string. Throws ArgumentException if the width is too small
static string Ultimate.Utilities.StringUtils.AbbreviateMiddle ( string  str,
string  middle,
int  length 
)
static

Abbreviates a String to the length passed, replacing the middle characters with the given replacement String.

StringUtils.AbbreviateMiddle(null, null, 0) = null

StringUtils.AbbreviateMiddle("abc", null, 0) = "abc"

StringUtils.AbbreviateMiddle("abc", ".", 0) = "abc"

StringUtils.AbbreviateMiddle("abc", ".", 3) = "abc"

StringUtils.AbbreviateMiddle("abcdef", ".", 4) = "ab.f"

Parameters
strinput string
middlethe String to replace the middle characters with
lengthlength to abbreviate
Returns
the abbreviated string or original string if the replacement string is null
static string Ultimate.Utilities.StringUtils.AppendIfMissing ( string  str,
string  suffix,
bool  ignoreCase = false,
ICollection< string >  suffixes = null 
)
static

Appends the given suffix to the end of the string if the string does not already end with the suffix.

StringUtils.AppendIfMissing(null, null) = null

StringUtils.AppendIfMissing("abc", null) = "abc"

StringUtils.AppendIfMissing("", "xyz") = "xyz"

StringUtils.AppendIfMissing("abc", "xyz") = "abcxyz"

StringUtils.AppendIfMissing("abcxyz", "xyz") = "abcxyz"

StringUtils.AppendIfMissing("abcXYZ", "xyz") = "abcXYZxyz"

StringUtils.AppendIfMissing(null, null, true) = null

StringUtils.AppendIfMissing("abc", null, true) = "abc"

StringUtils.AppendIfMissing("", "xyz", true) = "xyz"

StringUtils.AppendIfMissing("abc", "xyz",false, {null}) = "abcxyz"

StringUtils.AppendIfMissing("abcxyz", "xyz",false, {"mno"}) = "abcxyz"

StringUtils.AppendIfMissing("abcmno", "xyz",false, {"mno"}) = "abcmno"

StringUtils.AppendIfMissing("abcXYZ", "xyz",false, {"mno"}) = "abcXYZxyz"

StringUtils.AppendIfMissing("abcMNO", "xyz",false, {"mno"}) = "abcMNOxyz"

Parameters
strinput string
suffixsuffix to add at the end of the string
ignoreCaseis case ignored? (default false)
suffixesarray of suffixes. Once a suffix is found others will be terminated (default null)
Returns
string with suffix added if it doesn't already has it
static string Ultimate.Utilities.StringUtils.AppendIfMissingIgnoreCase ( string  str,
string  suffix,
string[]  suffixes = null 
)
static

Appends the given suffix to the end of the string if the string does not already end with the suffix. Ignores the casing while searching for the suffix.

StringUtils.AppendIfMissingIgnoreCase(null, null) = null

StringUtils.AppendIfMissingIgnoreCase("abc", null) = "abc"

StringUtils.AppendIfMissingIgnoreCase("", "xyz") = "xyz"

StringUtils.AppendIfMissingIgnoreCase("abc", "xyz") = "abcxyz"

StringUtils.AppendIfMissingIgnoreCase("abcxyz", "xyz") = "abcxyz"

StringUtils.AppendIfMissingIgnoreCase("abcXYZ", "xyz") = "abcXYZ"

StringUtils.AppendIfMissingIgnoreCase(null, null, null) = null

StringUtils.AppendIfMissingIgnoreCase("abc", null, null) = "abc"

StringUtils.AppendIfMissingIgnoreCase("", "xyz", null) = "xyz"

StringUtils.AppendIfMissingIgnoreCase("abc", "xyz", {null}) = "abcxyz"

StringUtils.AppendIfMissingIgnoreCase("abc", "xyz", {""}) = "abc"

StringUtils.AppendIfMissingIgnoreCase("abc", "xyz", {"mno"}) = "abcxyz"

StringUtils.AppendIfMissingIgnoreCase("abcxyz", "xyz", {"mno"}) = "abcxyz"

StringUtils.AppendIfMissingIgnoreCase("abcmno", "xyz", {"mno"}) = "abcmno"

StringUtils.AppendIfMissingIgnoreCase("abcXYZ", "xyz", {"mno"}) = "abcXYZ"

StringUtils.AppendIfMissingIgnoreCase("abcMNO", "xyz", {"mno"}) = "abcMNO"

Parameters
strinput string
suffixsuffix to add at the end of the string
suffixesarray of suffixes. Once a suffix is found others will be terminated (default null)
Returns
string with suffix added if it doesn't already has it
static string Ultimate.Utilities.StringUtils.Capitalize ( string  str)
static

Capitalizes a string by changing the first letter to a title letter

StringUtils.Capitalize(null) = null

StringUtils.Capitalize("") = ""

StringUtils.Capitalize("cat") = "Cat"

StringUtils.Capitalize("cAt") = "CAt"

Parameters
strinput string
Returns
Capitalized string
static string Ultimate.Utilities.StringUtils.Center ( string  str,
int  size 
)
static

Centers a String in a larger String of size using space (' ')

StringUtils.Center(null, *) = null

StringUtils.Center("", 4) = " "

StringUtils.Center("ab", -1) = "ab"

StringUtils.Center("ab", 4) = " ab "

StringUtils.Center("abcd", 2) = "abcd"

StringUtils.Center("a", 4) = " a "

Parameters
strinput string
sizesize of new String, negative treated as zero
Returns
centered string
static string Ultimate.Utilities.StringUtils.Center ( string  str,
int  size,
char  padChar 
)
static

Centers a String in a larger String of size using the given character.

StringUtils.Center(null, *, *) = null

StringUtils.Center("", 4, ' ') = " "

StringUtils.Center("ab", -1, ' ') = "ab"

StringUtils.Center("ab", 4, ' ') = " ab "

StringUtils.Center("abcd", 2, ' ') = "abcd"

StringUtils.Center("a", 4, ' ') = " a "

StringUtils.Center("a", 4, 'y') = "yayy"

Parameters
strinput string
sizesize of new String, negative treated as zero
padCharcharacter to pad with
Returns
centered string
static string Ultimate.Utilities.StringUtils.Center ( string  str,
int  size,
string  padStr 
)
static

Centers a String in a larger String of size using the given string.

StringUtils.Center(null, *, *) = null

StringUtils.Center("", 4, " ") = " "

StringUtils.Center("ab", -1, " ") = "ab"

StringUtils.Center("ab", 4, " ") = " ab "

StringUtils.Center("abcd", 2, " ") = "abcd"

StringUtils.Center("a", 4, " ") = " a "

StringUtils.Center("a", 4, "yz") = "yayz"

StringUtils.Center("abc", 7, null) = " abc "

StringUtils.Center("abc", 7, "") = " abc "

Parameters
strinput string
sizesize of new String, negative treated as zero
padStrstring to pad with
Returns
centered string
static string Ultimate.Utilities.StringUtils.Chomp ( string  str)
static

Removes one newline from end of a String if it's there,otherwise string is unchanged.

A new line is
, or

StringUtils.Chomp(null) = null

StringUtils.Chomp("") = ""

StringUtils.Chomp("abc \r") = "abc "

StringUtils.Chomp("abc\n") = "abc"

StringUtils.Chomp("abc\r\n") = "abc"

StringUtils.Chomp("abc\r\n\r\n") = "abc\r\n"

StringUtils.Chomp("abc\n\r") = "abc\n"

StringUtils.Chomp("abc\n\rabc") = "abc\n\rabc"

StringUtils.Chomp("\r") = ""

StringUtils.Chomp("\n") = ""

StringUtils.Chomp("\r\n") = ""

Parameters
strinput string
Returns
string without new line
static string Ultimate.Utilities.StringUtils.Chop ( string  str)
static

Remove the last character from a String.

StringUtils.Chop(null) = null

StringUtils.Chop("") = ""

StringUtils.Chop("abc \r") = "abc "

StringUtils.Chop("abc\n") = "abc"

StringUtils.Chop("abc\r\n") = "abc"

StringUtils.Chop("abc") = "ab"

StringUtils.Chop("abc\nabc") = "abc\nab"

StringUtils.Chop("a") = ""

StringUtils.Chop("\r") = ""

StringUtils.Chop("\n") = ""

StringUtils.Chop("\r\n") = ""

Parameters
strinput string
Returns
string without last character
static bool Ultimate.Utilities.StringUtils.Contains ( string  str,
string  searchValue 
)
static

Checks if a string conatins the given search string.

StringUtils.Contains(null, *) = false

StringUtils.Contains(*, null) = false

StringUtils.Contains("", "") = true

StringUtils.Contains("abc", "") = true

StringUtils.Contains("abc", "a") = true

StringUtils.Contains("abc", "z") = false

Parameters
strinput string
searchValuesearch string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.Contains ( string  str,
char  searchValue 
)
static

Checks if a string conatins the given search character.

StringUtils.Contains(null, *) = false

StringUtils.Contains("", *) = false

StringUtils.Contains("abc", 'a') = true

StringUtils.Contains("abc", 'z') = false

Parameters
strinput string
searchValuesearch char
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsAny ( string  str,
params char[]  searchChars 
)
static

Checks if the string contains any character from the given set of characters.

StringUtils.ContainsAny(null, *) = false

StringUtils.ContainsAny("", *) = false

StringUtils.ContainsAny(*, null) = false

StringUtils.ContainsAny(*, []) = false

StringUtils.ContainsAny("zzabyycdxx",'z','a') = true

StringUtils.ContainsAny("zzabyycdxx",'b','y') = true

StringUtils.ContainsAny("zzabyycdxx",'z','y') = true

StringUtils.ContainsAny("aba", 'z') = false

Parameters
strinput string
searchCharssearch characters
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsAny ( string  str,
string  searchChars 
)
static

Checks if the string contains any character from the given set of characters.

StringUtils.ContainsAny(null, *) = false

StringUtils.ContainsAny("", *) = false

StringUtils.ContainsAny(*, null) = false

StringUtils.ContainsAny("zzabyycdxx","za") = true

StringUtils.ContainsAny("zzabyycdxx","by") = true

StringUtils.ContainsAny("zzabyycdxx","zy"]) = true

StringUtils.ContainsAny("aba", "z") = false

Parameters
strinput string
searchCharssearch characters
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsAny ( string  str,
params string[]  searchStrings 
)
static

Checks if the string contains any of the strings in the given array.

StringUtils.ContainsAny(null, *) = false

StringUtils.ContainsAny("", *) = false

StringUtils.ContainsAny(*, null) = false

StringUtils.ContainsAny(*, []) = false

StringUtils.ContainsAny("abcd", "ab", null) = true

StringUtils.ContainsAny("abcd", "ab", "cd") = true

StringUtils.ContainsAny("abc", "d", "abc") = true

Parameters
strinput string
searchStringssearch strings
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsIgnoreCase ( string  str,
string  searchValue 
)
static

Checks if a string conatins the given search string.,ignoring case

StringUtils.ContainsIgnoreCase(null, *) = false

StringUtils.ContainsIgnoreCase(*, null) = false

StringUtils.ContainsIgnoreCase("", "") = true

StringUtils.ContainsIgnoreCase("abc", "") = true

StringUtils.ContainsIgnoreCase("abc", "A") = true

StringUtils.ContainsIgnoreCase("abc", "z") = false

Parameters
strinput string
searchValuesearch string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsIgnoreCase ( string  str,
char  searchValue 
)
static

Checks if a string conatins the given search character.,ignoring case

StringUtils.ContainsIgnoreCase(null, *) = false

StringUtils.ContainsIgnoreCase("", *) = false

StringUtils.ContainsIgnoreCase("abc", 'A') = true

StringUtils.ContainsIgnoreCase("abc", 'z') = false

Parameters
strinput string
searchValuesearch char
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsNone ( string  str,
params char[]  searchChars 
)
static

Checks if the string contains none of the given set of characters.

StringUtils.ContainsNone(null, *) = true

StringUtils.ContainsNone(*, null) = true

StringUtils.ContainsNone("", *) = true

StringUtils.ContainsNone("ab", 'a') = false

StringUtils.ContainsNone("abab", 'x','y','z') = true

StringUtils.ContainsNone("ab1", 'x','y','z') = true

StringUtils.ContainsNone("abz", ['x','y','z']) = false

Parameters
strinput string
searchCharssearch characters
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsNone ( string  str,
string  searchChars 
)
static

Checks if the string contains none of the given set of characters.

StringUtils.ContainsNone(null, *) = true

StringUtils.ContainsNone(*, null) = true

StringUtils.ContainsNone("", *) = true

StringUtils.ContainsNone("ab", "") = true

StringUtils.ContainsNone("abab", "xyz") = true

StringUtils.ContainsNone("ab1", "xyz") = true

StringUtils.ContainsNone("abz", "xyz") = false

Parameters
strinput string
searchCharssearch characters
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsOnly ( string  str,
params char[]  searchChars 
)
static

Checks if the string contains only the given set of characters.

StringUtils.ContainsOnly(null, *) = false

StringUtils.ContainsOnly(*, null) = false

StringUtils.ContainsOnly("", *) = true

StringUtils.ContainsOnly("ab", '') = false

StringUtils.ContainsOnly("abab", 'a','b','c') = true

StringUtils.ContainsOnly("ab1", 'a','b','c') = false

StringUtils.ContainsOnly("abz", ['a','b','c']) = false

Parameters
strinput string
searchCharssearch characters
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsOnly ( string  str,
string  searchChars 
)
static

Checks if the string contains only the given set of characters.

StringUtils.ContainsOnly(null, *) = false

StringUtils.ContainsOnly(*, null) = false

StringUtils.ContainsOnly("", *) = true

StringUtils.ContainsOnly("ab", "") = false

StringUtils.ContainsOnly("abab", "abc") = true

StringUtils.ContainsOnly("ab1", "abc") = false

StringUtils.ContainsOnly("abz", "abc") = false

Parameters
strinput string
searchCharssearch characters
Returns
true or false
static bool Ultimate.Utilities.StringUtils.ContainsWhiteSpace ( string  str)
static

Checks whether a given string contains any Whitespace characters.

StringUtils.ContainsWhiteSpace(null) = false

StringUtils.ContainsWhiteSpace("") = false

StringUtils.ContainsWhiteSpace("abc ") = true

StringUtils.ContainsWhiteSpace("a bc") = true

StringUtils.ContainsWhiteSpace("abc") = false

Parameters
strinput string
Returns
true or false
static int Ultimate.Utilities.StringUtils.CountMatches ( string  str,
string  sub 
)
static

Counts how many times the substring appears in the larger string.

StringUtils.CountMatches(null, *) = 0

StringUtils.CountMatches("", *) = 0

StringUtils.CountMatches("abba", null) = 0

StringUtils.CountMatches("abba", "") = 0

StringUtils.CountMatches("abba", "a") = 2

StringUtils.CountMatches("abba", "ab") = 1

StringUtils.CountMatches("abba", "xxx") = 0

Parameters
strinput string
subsubstring to search for
Returns
the count of substring matches
static int Ultimate.Utilities.StringUtils.CountMatches ( string  str,
char  ch 
)
static

Counts how many times a character appears in the larger string.

StringUtils.CountMatches(null, *) = 0

StringUtils.CountMatches("", *) = 0

StringUtils.CountMatches("abba", '0') = 0

StringUtils.CountMatches("abba", 'a') = 2

StringUtils.CountMatches("abba", 'b') = 2

StringUtils.CountMatches("abba", 'x') = 0

Parameters
strinput string
chcharacter to search for
Returns
the count of character matches
static string Ultimate.Utilities.StringUtils.DefaultIfBlank ( string  str,
string  defaultStr = "" 
)
static

Returns either the input string or the default string if the input string is blank

StringUtils.DefaultIfBlank(null, "abc") = "abc"

StringUtils.DefaultIfBlank("") = ""

StringUtils.DefaultIfBlank(" ") = ""

StringUtils.DefaultIfBlank("bat", "abc") = "bat"

StringUtils.DefaultIfBlank("", null) = null

Parameters
strinput string
defaultStrdefault string to be returned incase of blank ("" will be returned by default if not passed)
Returns
passed string or default string if it was blank
static string Ultimate.Utilities.StringUtils.DefaultIfEmpty ( string  str,
string  defaultStr 
)
static

Returns either the input string or the default string if the input string is Empty

StringUtils.DefaultIfEmpty(null, "NULL") = "NULL"

StringUtils.DefaultIfEmpty("", "NULL") = "NULL"

StringUtils.DefaultIfEmpty(" ", "NULL") = " "

StringUtils.DefaultIfEmpty("bat", "NULL") = "bat"

StringUtils.DefaultIfEmpty("", null) = null

Parameters
strinput string
defaultStrdefault string to be returned incase of empty
Returns
passed string or default string if it was empty
static string Ultimate.Utilities.StringUtils.DefaultString ( string  str,
string  defaultStr = "" 
)
static

Returns either the input string or the default string if the input string is null

StringUtils.DefaultString(null) = ""

StringUtils.DefaultString("") = ""

StringUtils.DefaultString("bat") = "bat"

Parameters
strinput string
defaultStrdefault string to be returned incase of null ("" will be returned by default if not passed)
Returns
passed string or default string if it was null
static string Ultimate.Utilities.StringUtils.DeleteWhitespace ( string  str)
static

Deletes all whitespaces from a String

StringUtils.DeleteWhitespace(null) = null

StringUtils.DeleteWhitespace("") = ""

StringUtils.DeleteWhitespace("abc") = "abc"

StringUtils.DeleteWhitespace(" ab c ") = "abc"

Parameters
strinput string
Returns
the string without whitespaces
static string Ultimate.Utilities.StringUtils.Difference ( string  str1,
string  str2 
)
static

Compares two Strings, and returns the part of string where they differ.

StringUtils.Difference(null, null) = null

StringUtils.Difference("", "") = ""

StringUtils.Difference("", "abc") = "abc"

StringUtils.Difference("abc", "") = ""

StringUtils.Difference("abc", "abc") = ""

StringUtils.Difference("abc", "ab") = ""

StringUtils.Difference("ab", "abxyz") = "xyz"

StringUtils.Difference("abcde", "abxyz") = "xyz"

StringUtils.Difference("abcde", "xyz") = "xyz"

Parameters
str1the first string
str2the second string
Returns
the portion of str2 where it differs from str1; returns empty String if both are equal
static bool Ultimate.Utilities.StringUtils.EndsWith ( string  str,
string  suffix,
bool  ignoreCase = false 
)
static

Checks if a string ends with a specified suffix.

StringUtils.EndsWith(null, null) = true

StringUtils.EndsWith(null, "def") = false

StringUtils.EndsWith("abcdef", null) = false

StringUtils.EndsWith("abcdef", "def") = true

StringUtils.EndsWith("ABCDEF", "def") = false

StringUtils.EndsWith("ABCDEF", "cde") = false

Parameters
strinput string
suffixthe suffix to find
ignoreCaseis case ignored? (default false)
Returns
true or false
static bool Ultimate.Utilities.StringUtils.EndsWithAny ( string  str,
bool  ignoreCase,
params string[]  searchStrings 
)
static

Checks if a string ends with any of an array of specified strings.

StringUtils.EndsWithAny(null, null) = false

StringUtils.EndsWithAny(null, new String[] {"abc"}) = false

StringUtils.EndsWithAny("abcxyz", null) = false

StringUtils.EndsWithAny("abcxyz", new String[] {""}) = true

StringUtils.EndsWithAny("abcxyz", new String[] {"xyz"}) = true

StringUtils.EndsWithAny("abcxyz", new String[] {null, "xyz", "abc"}) = true

Parameters
strinput string
ignoreCaseis case ignored? (default false)
searchStringsarray of suffix search strings
Returns
true or false
static bool Ultimate.Utilities.StringUtils.EndsWithIgnoreCase ( string  str,
string  suffix 
)
static

Checks if a string ends with a specified suffix by ignoring case.

StringUtils.EndsWithIgnoreCase(null, null) = true

StringUtils.EndsWithIgnoreCase(null, "def") = false

StringUtils.EndsWithIgnoreCase("abcdef", null) = false

StringUtils.EndsWithIgnoreCase("abcdef", "def") = true

StringUtils.EndsWithIgnoreCase("ABCDEF", "def") = true

StringUtils.EndsWithIgnoreCase("ABCDEF", "cde") = false

Parameters
strinput string
suffixthe suffix to find
Returns
true or false
static bool Ultimate.Utilities.StringUtils.Equals ( string  s1,
string  s2 
)
static

Compares two strings and returns true if they represent equal sequence of characters.

StringUtils.Equals(null, null) = true

StringUtils.Equals(null, "abc") = false

StringUtils.Equals("abc", null) = false

StringUtils.Equals("abc", "abc") = true

StringUtils.Equals("abc", "ABC") = false

Parameters
s1string1
s2string2
Returns
true or false
static bool Ultimate.Utilities.StringUtils.EqualsIgnoreCase ( string  s1,
string  s2 
)
static

Compares two strings by ignoring case and returns true if they represent equal sequence of characters.

StringUtils.EqualsIgnoreCase(null, null) = true

StringUtils.EqualsIgnoreCase(null, "abc") = false

StringUtils.EqualsIgnoreCase("abc", null) = false

StringUtils.EqualsIgnoreCase("abc", "abc") = true

StringUtils.EqualsIgnoreCase("abc", "ABC") = true

Parameters
s1string1
s2string2
Returns
true or false
static string Ultimate.Utilities.StringUtils.GetCommonPrefix ( params string[]  strs)
static

Compares all Strings in an array and returns the initial sequence of characters that is common to all of them.

StringUtils.GetCommonPrefix(null) = ""

StringUtils.GetCommonPrefix(new String[] {}) = ""

StringUtils.GetCommonPrefix(new String[] {"abc"}) = "abc"

StringUtils.GetCommonPrefix(new String[] {null, null}) = ""

StringUtils.GetCommonPrefix(new String[] {"", ""}) = ""

StringUtils.GetCommonPrefix(new String[] {"", null}) = ""

StringUtils.GetCommonPrefix(new String[] {"abc", null, null}) = ""

StringUtils.GetCommonPrefix(new String[] {null, null, "abc"}) = ""

StringUtils.GetCommonPrefix(new String[] {"", "abc"}) = ""

StringUtils.GetCommonPrefix(new String[] {"abc", ""}) = ""

StringUtils.GetCommonPrefix(new String[] {"abc", "abc"}) = "abc"

StringUtils.GetCommonPrefix(new String[] {"abc", "a"}) = "a"

StringUtils.GetCommonPrefix(new String[] {"ab", "abxyz"}) = "ab"

StringUtils.GetCommonPrefix(new String[] {"abcde", "abxyz"}) = "ab"

StringUtils.GetCommonPrefix(new String[] {"abcde", "xyz"}) = ""

StringUtils.GetCommonPrefix(new String[] {"xyz", "abcde"}) = ""

StringUtils.GetCommonPrefix(new String[] {"i am a machine", "i am a robot"}) = "i am a "

Parameters
strsinpu array of strings
Returns
the common prefix if any or ""
static int Ultimate.Utilities.StringUtils.IndexOf ( string  s1,
char  searchValue,
int  startPos = 0 
)
static

Finds the first index of the given character within a string.

StringUtils.IndexOf(null, *) = -1

StringUtils.IndexOf("", *) = -1

StringUtils.IndexOf("aabaabaa", 'a') = 0

StringUtils.IndexOf("aabaabaa", 'b') = 2

StringUtils.IndexOf("aabaabaa", 'b', 3) = 5

Parameters
s1string
searchValuesearch char
startPosstarting position
Returns
index of the char if found or -1
static int Ultimate.Utilities.StringUtils.IndexOf ( string  s1,
string  searchValue,
int  startPos = 0 
)
static

Finds the first index of the given string within a string.

StringUtils.IndexOf(null, *) = -1

StringUtils.IndexOf(*, null) = -1

StringUtils.IndexOf("", "") = 0

StringUtils.IndexOf("", "a") = -1

StringUtils.IndexOf("aabaabaa", "a") = 0

StringUtils.IndexOf("aabaabaa", "b") = 2

StringUtils.IndexOf("aabaabaa", "ab") = 1

StringUtils.IndexOf("aabaabaa", "") = 0

StringUtils.IndexOf("aabaabaa", "b", 3) = 5

StringUtils.IndexOf("aabaabaa", "b", 9) = -1

Parameters
s1string
searchValuesearch string
startPosstarting position
Returns
index of the string if found or -1
static int Ultimate.Utilities.StringUtils.IndexOfAny ( string  str,
params char[]  searchChars 
)
static

Search a string to find the first index of any character in the given set of search characters.

StringUtils.IndexOfAny(null, *) = -1

StringUtils.IndexOfAny("", *) = -1

StringUtils.IndexOfAny(*, null) = -1

StringUtils.IndexOfAny(*, []) = -1

StringUtils.IndexOfAny("zzabyycdxx",'z','a') = 0

StringUtils.IndexOfAny("zzabyycdxx",['b','y']) = 3

StringUtils.IndexOfAny("aba", 'z') = -1

Parameters
strinput string
searchCharssearch characters
Returns
index if found or -1
static int Ultimate.Utilities.StringUtils.IndexOfAny ( string  str,
string  searchChars 
)
static

Search a string to find the first index of any character in the given set of search characters.

StringUtils.IndexOfAny(null, *) = -1

StringUtils.IndexOfAny("", *) = -1

StringUtils.IndexOfAny(*, null) = -1

StringUtils.IndexOfAny("zzabyycdxx","za") = 0

StringUtils.IndexOfAny("zzabyycdxx","by") = 3

StringUtils.IndexOfAny("aba", "z") = -1

Parameters
strinput string
searchCharssearch characters
Returns
index if found or -1
static int Ultimate.Utilities.StringUtils.IndexOfAny ( string  str,
params string[]  searchStrs 
)
static

Searches a string to find the first index of any of the given set of substrings.

StringUtils.IndexOfAny(null, *) = -1

StringUtils.IndexOfAny(*, null) = -1

StringUtils.IndexOfAny(*, []) = -1

StringUtils.IndexOfAny("zzabyycdxx", "ab","cd") = 2

StringUtils.IndexOfAny("zzabyycdxx", "cd","ab") = 2

StringUtils.IndexOfAny("zzabyycdxx", "mn","op") = -1

StringUtils.IndexOfAny("zzabyycdxx", ["zab","aby"]) = 1

StringUtils.IndexOfAny("zzabyycdxx", [""]) = 0

StringUtils.IndexOfAny("", [""]) = 0

StringUtils.IndexOfAny("", ["a"]) = -1

Parameters
strinput string
searchStrssearch strings array
Returns
index if found or -1
static int Ultimate.Utilities.StringUtils.IndexOfAnyBut ( string  str,
params char[]  searchChars 
)
static

Searches a string to find the first index of any character not in the given set of characters.

StringUtils.IndexOfAnyBut(null, *) = -1

StringUtils.IndexOfAnyBut("", *) = -1

StringUtils.IndexOfAnyBut(*, null) = -1

StringUtils.IndexOfAnyBut(*, []) = -1

StringUtils.IndexOfAnyBut("zzabyycdxx", 'z', 'a' ) = 3

StringUtils.IndexOfAnyBut("aba", 'z' ) = 0

StringUtils.IndexOfAnyBut("aba", new char[] {'a', 'b'} ) = -1

Parameters
strinput string
searchCharsnot in search characters
Returns
true or false
static int Ultimate.Utilities.StringUtils.IndexOfAnyBut ( string  str,
string  searchChars 
)
static

Searches a string to find the first index of any character not in the given set of characters.

StringUtils.IndexOfAnyBut(null, *) = -1

StringUtils.IndexOfAnyBut("", *) = -1

StringUtils.IndexOfAnyBut(*, null) = -1

StringUtils.IndexOfAnyBut(*, "") = -1

StringUtils.IndexOfAnyBut("zzabyycdxx", "za") = 3

StringUtils.IndexOfAnyBut("zzabyycdxx", "") = -1

StringUtils.IndexOfAnyBut("aba","ab") = -1

Parameters
strinput string
searchCharsnot in search characters
Returns
true or false
static int Ultimate.Utilities.StringUtils.IndexOfDifference ( string  str1,
string  str2 
)
static

Compares two Strings, and returns the index at which they begin to differ.

StringUtils.IndexOfDifference(null, null) = -1

StringUtils.IndexOfDifference("", "") = -1

StringUtils.IndexOfDifference("", "abc") = 0

StringUtils.IndexOfDifference("abc", "") = 0

StringUtils.IndexOfDifference("abc", "abc") = -1

StringUtils.IndexOfDifference("ab", "abxyz") = 2

StringUtils.IndexOfDifference("abcde", "abxyz") = 2

StringUtils.IndexOfDifference("abcde", "xyz") = 0

Parameters
str1the first string
str2the second string
Returns
index at which str1 and str2 begin to differ; returns -1 if both are equal
static int Ultimate.Utilities.StringUtils.IndexOfDifference ( params string[]  strArray)
static

Compares all strings in an array and returns the index at which the strings begin to differ.

StringUtils.IndexOfDifference(null) = -1

StringUtils.IndexOfDifference(new String[] {}) = -1

StringUtils.IndexOfDifference(new String[] {"abc"}) = -1

StringUtils.IndexOfDifference(new String[] {null, null}) = -1

StringUtils.IndexOfDifference(new String[] {"", ""}) = -1

StringUtils.IndexOfDifference(new String[] {"", null}) = 0

StringUtils.IndexOfDifference(new String[] {"abc", null, null}) = 0

StringUtils.IndexOfDifference(new String[] {null, null, "abc"}) = 0

StringUtils.IndexOfDifference(new String[] {"", "abc"}) = 0

StringUtils.IndexOfDifference(new String[] {"abc", ""}) = 0

StringUtils.IndexOfDifference(new String[] {"abc", "abc"}) = -1

StringUtils.IndexOfDifference(new String[] {"abc", "a"}) = 1

StringUtils.IndexOfDifference(new String[] {"ab", "abxyz"}) = 2

StringUtils.IndexOfDifference(new String[] {"abcde", "abxyz"}) = 2

StringUtils.IndexOfDifference(new String[] {"abcde", "xyz"}) = 0

StringUtils.IndexOfDifference(new String[] {"xyz", "abcde"}) = 0

StringUtils.IndexOfDifference(new String[] {"i am a machine", "i am a robot"}) = 7

Parameters
strArrayinput array of strings
Returns
the index at which the strings start to differ or -1 if all are equal
static int Ultimate.Utilities.StringUtils.IndexOfIgnoreCase ( string  s1,
string  searchValue,
int  startPos = 0 
)
static

Finds the first index of the given string within a string by ignoring case.

StringUtils.IndexOfIgnoreCase(null, *) = -1

StringUtils.IndexOfIgnoreCase(*, null) = -1

StringUtils.IndexOfIgnoreCase("", "") = 0

StringUtils.IndexOfIgnoreCase("aabaabaa", "A") = 0

StringUtils.IndexOfIgnoreCase("aabaabaa", "B") = 2

StringUtils.IndexOfIgnoreCase("aabaabaa", "ab") = 1

StringUtils.IndexOfIgnoreCase("aabaabaa", "B", 3) = 5

StringUtils.IndexOfIgnoreCase("aabaabaa", "B", 9) = -1

Parameters
s1string
searchValuesearch string
startPosstarting position
Returns
index of the string if found or -1
static int Ultimate.Utilities.StringUtils.IndexOfIgnoreCase ( string  s1,
char  searchValue,
int  startPos = 0 
)
static

Finds the first index of the given character within a string by ignoring case.

StringUtils.IndexOfIgnoreCase(null, *) = -1

StringUtils.IndexOfIgnoreCase("", *) = -1

StringUtils.IndexOfIgnoreCase("aabaabaa", 'A') = 0

StringUtils.IndexOfIgnoreCase("aabaabaa", 'b') = 2

StringUtils.IndexOfIgnoreCase("aabaabaa", 'B', 3) = 5

Parameters
s1string
searchValuesearch char
startPosstarting position
Returns
index of the char if found or -1
static bool Ultimate.Utilities.StringUtils.IsAllLowerCase ( string  str)
static

Checks if the string contains only lowercase letters

StringUtils.IsAllLowerCase(null) = false

StringUtils.IsAllLowerCase("") = false

StringUtils.IsAllLowerCase(" ") = false

StringUtils.IsAllLowerCase("abc") = true

StringUtils.IsAllLowerCase("abC") = false

StringUtils.IsAllLowerCase("ab c") = false

StringUtils.IsAllLowerCase("ab1c") = false

StringUtils.IsAllLowerCase("ab/c") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsAllUpperCase ( string  str)
static

Checks if the string contains only uppercase letters

StringUtils.IsAllUpperCase(null) = false

StringUtils.IsAllUpperCase("") = false

StringUtils.IsAllUpperCase(" ") = false

StringUtils.IsAllUpperCase("ABC") = true

StringUtils.IsAllUpperCase("aBC") = false

StringUtils.IsAllUpperCase("A C") = false

StringUtils.IsAllUpperCase("A1C") = false

StringUtils.IsAllUpperCase("A/C") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsAlpha ( string  str)
static

Checks if the string contains only Unicode letters

StringUtils.IsAlpha(null) = false

StringUtils.IsAlpha("") = false

StringUtils.IsAlpha(" ") = false

StringUtils.IsAlpha("abc") = true

StringUtils.IsAlpha("ab2c") = false

StringUtils.IsAlpha("ab-c") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsAlphaNumeric ( string  str)
static

Checks if the string contains only Unicode letters and numbers

StringUtils.IsAlphaNumeric(null) = false

StringUtils.IsAlphaNumeric("") = false

StringUtils.IsAlphaNumeric(" ") = false

StringUtils.IsAlphaNumeric("abc") = true

StringUtils.IsAlphaNumeric("ab c") = false

StringUtils.IsAlphaNumeric("ab2c") = true

StringUtils.IsAlphaNumeric("ab-c") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsAlphaNumericSpace ( string  str)
static

Checks if the string contains only Unicode letters and numbers

StringUtils.IsAlphaNumericSpace(null) = false

StringUtils.IsAlphaNumericSpace("") = true

StringUtils.IsAlphaNumericSpace(" ") = true

StringUtils.IsAlphaNumericSpace("abc") = true

StringUtils.IsAlphaNumericSpace("ab c") = true

StringUtils.IsAlphaNumericSpace("ab2c") = true

StringUtils.IsAlphaNumericSpace("ab-c") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsAlphaSpace ( string  str)
static

Checks if the string contains only Unicode letters and space

StringUtils.IsAlphaSpace(null) = false

StringUtils.IsAlphaSpace("") = true

StringUtils.IsAlphaSpace(" ") = true

StringUtils.IsAlphaSpace("abc") = true

StringUtils.IsAlphaSpace("ab c") = true

StringUtils.IsAlphaSpace("ab2c") = false

StringUtils.IsAlphaSpace("ab-c") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsAnyBlank ( params string[]  strArgs)
static

Checks if any of the Strings are Empty (""),Null or Whitespace (" ")

See below examples

StringUtils.IsAnyBlank(null) = true

StringUtils.IsAnyBlank(null, "abc") = true

StringUtils.IsAnyBlank(null, null) = true

StringUtils.IsAnyBlank("", "xyz") = true

StringUtils.IsAnyBlank("abc", "") = true

StringUtils.IsAnyBlank(" abc ", null) = true

StringUtils.IsAnyBlank(" ", "xyz") = true

StringUtils.IsAnyBlank("abc", "xyz") = false

Parameters
strArgsinput strings array
Returns
true or false

summary> Checks if none of the Strings are Empty (""), Null and Whitespace (" ")

See below examples

StringUtils.IsNoneBlank(null) = false

StringUtils.IsNoneBlank(null, "abc") = false

StringUtils.IsNoneBlank(null, null) = false

StringUtils.IsNoneBlank("", "xyz") = false

StringUtils.IsNoneBlank("abc", "") = false

StringUtils.IsNoneBlank(" abc ", null) = false

StringUtils.IsNoneBlank(" ", "xyz") = false

StringUtils.IsNoneBlank("abc", "xyz") = true

Parameters
strArgsinput strings array
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsAnyEmpty ( params string[]  strArgs)
static

Checks if any of the Strings are Empty ("") or Null

See below examples

StringUtils.IsAnyEmpty(null) = true

StringUtils.IsAnyEmpty(null, "abc") = true

StringUtils.IsAnyEmpty("", "xyz") = true

StringUtils.IsAnyEmpty("abc", "") = true

StringUtils.IsAnyEmpty(" abc ", null) = true

StringUtils.IsAnyEmpty(" ", "xyz") = false

StringUtils.IsAnyEmpty("abc", "xyz") = false

Parameters
strArgsinput strings array
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsAsciiPrintable ( string  str)
static

Checks if the string contains only ASCII printable characters.

StringUtils.IsAsciiPrintable(null) = false

StringUtils.IsAsciiPrintable("") = true

StringUtils.IsAsciiPrintable(" ") = true

StringUtils.IsAsciiPrintable("Ceki") = true

StringUtils.IsAsciiPrintable("ab2c") = true

StringUtils.IsAsciiPrintable("!ab-c~") = true

StringUtils.IsAsciiPrintable("\u0020") = true

StringUtils.IsAsciiPrintable("\u0021") = true

StringUtils.IsAsciiPrintable("\u007e") = true

StringUtils.IsAsciiPrintable("\u007f") = false

StringUtils.IsAsciiPrintable("Ceki G\u00fclc\u00fc") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsBlank ( string  str)
static

Checks if a String is Empty (""),Null or Whitespace (" ")

See below examples

StringUtils.IsBlank(null) = true

StringUtils.IsBlank("") = true

StringUtils.IsBlank(" ") = true

StringUtils.IsBlank("abc") = false

StringUtils.IsBlank(" abc ") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsEmpty ( string  str)
static

Checks If a String is Empty ("") or Null

See below examples

StringUtils.IsEmpty(null) = true

StringUtils.IsEmpty("") = true

StringUtils.IsEmpty(" ") = false

StringUtils.IsEmpty("abc") = false

StringUtils.IsEmpty(" abc ") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsNoneEmpty ( params string[]  strArgs)
static

Checks if None of the Strings are Empty ("") and Null

See below examples

StringUtils.IsNoneEmpty(null) = false

StringUtils.IsNoneEmpty(null, "abc") = false

StringUtils.IsNoneEmpty("", "xyz") = false

StringUtils.IsNoneEmpty("abc", "") = false

StringUtils.IsNoneEmpty(" abc ", null) = false

StringUtils.IsNoneEmpty(" ", "xyz") = true

StringUtils.IsNoneEmpty("abc", "xyz") = true

Parameters
strArgsinput strings array
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsNotBlank ( string  str)
static

Checks if a String is Not Empty (""),Not Null and Not Whitespace (" ")

See below examples

StringUtils.IsNotBlank(null) = false

StringUtils.IsNotBlank("") = false

StringUtils.IsNotBlank(" ") = false

StringUtils.IsNotBlank("abc") = true

StringUtils.IsNotBlank(" abc ") = true

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsNotEmpty ( string  str)
static

Checks If a String is Not Empty ("") and Not Null

See below examples

StringUtils.IsNotEmpty(null) = false

StringUtils.IsNotEmpty("") = false

StringUtils.IsNotEmpty(" ") = true

StringUtils.IsNotEmpty("abc") = true

StringUtils.IsNotEmpty(" abc ") = true

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsNumeric ( string  str)
static

Checks if the string contains only Unicode numbers

StringUtils.IsNumeric(null) = false

StringUtils.IsNumeric("") = false

StringUtils.IsNumeric(" ") = false

StringUtils.IsNumeric("123") = true

StringUtils.IsNumeric("\u0967\u0968\u0969") = true

StringUtils.IsNumeric("12 3") = false

StringUtils.IsNumeric("ab2c") = false

StringUtils.IsNumeric("12-3") = false

StringUtils.IsNumeric("12.3") = false

StringUtils.IsNumeric("-123") = false

StringUtils.IsNumeric("+123") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsNumericSpace ( string  str)
static

Checks if the string contains only Unicode numbers or space

StringUtils.IsNumericSpace(null) = false

StringUtils.IsNumericSpace("") = false

StringUtils.IsNumericSpace(" ") = true

StringUtils.IsNumericSpace("123") = true

StringUtils.IsNumericSpace("12 3") = true

StringUtils.IsNumeric("\u0967\u0968\u0969") = true

StringUtils.IsNumeric("\u0967\u0968\u0969") = fa

StringUtils.IsNumericSpace("ab2c") = false

StringUtils.IsNumericSpace("12-3") = false

StringUtils.IsNumericSpace("12.3") = false

Parameters
strinput string
Returns
true or false
static bool Ultimate.Utilities.StringUtils.IsWhiteSpace ( string  str)
static

Checks if the string contains only whitespace

StringUtils.IsWhiteSpace(null) = false

StringUtils.IsWhiteSpace("") = true

StringUtils.IsWhiteSpace(" ") = true

StringUtils.IsWhiteSpace("abc") = false

StringUtils.IsWhiteSpace("ab2c") = false

StringUtils.IsWhiteSpace("ab-c") = false

Parameters
strinput string
Returns
true or false
static string Ultimate.Utilities.StringUtils.Join ( params string[]  elements)
static

Joins the elements of the given array into a single String containing the given list of elements.

StringUtils.Join(null) = null

StringUtils.Join([]) = ""

StringUtils.Join([null]) = ""

StringUtils.Join(["a", "b", "c"]) = "abc"

StringUtils.Join([null, "", "a"]) = "a"

Parameters
elementsinput array of elements
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( object[]  array,
string  separator = null 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator.

StringUtils.Join(null, *) = null

StringUtils.Join([], *) = ""

StringUtils.Join([null], *) = ""

StringUtils.Join(["a", "b", "c"], ";") = "a;b;c"

StringUtils.Join(["a", "b", "c"], null) = "abc"

StringUtils.Join([null, "", "a"], ";") = "a"

Parameters
arrayinput array of elements
separatorseperator character
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( long[]  array,
string  separator = null 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any.

StringUtils.Join(null, *) = null

StringUtils.Join([], *) = ""

StringUtils.Join([null], *) = ""

StringUtils.Join([1, 2, 3], ";") = "1;2;3"

StringUtils.Join([1, 2, 3], null) = "123"

Parameters
arrayinput array of elements
separatorseperator character(default null)
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( int[]  array,
string  separator = null 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any.

StringUtils.Join(null, *) = null

StringUtils.Join([], *) = ""

StringUtils.Join([1, 2, 3], ";") = "1;2;3"

StringUtils.Join([1, 2, 3], null) = "123"

Parameters
arrayinput array of elements
separatorseperator character(default null)
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( double[]  array,
string  separator = null 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any.

StringUtils.Join(null, *) = null

StringUtils.Join([], *) = ""

StringUtils.Join([1, 2, 3], ";") = "1;2;3"

StringUtils.Join([1, 2, 3], null) = "123"

Parameters
arrayinput array of elements
separatorseperator character(default null)
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( short[]  array,
string  separator = null 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any.

StringUtils.Join(null, *) = null

StringUtils.Join([], *) = ""

StringUtils.Join([1, 2, 3], ";") = "1;2;3"

StringUtils.Join([1, 2, 3], null) = "123"

Parameters
arrayinput array of elements
separatorseperator character(default null)
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( float[]  array,
string  separator = null 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any.

StringUtils.Join(null, *) = null

StringUtils.Join([], *) = ""

StringUtils.Join([1, 2, 3], ";") = "1;2;3"

StringUtils.Join([1, 2, 3], null) = "123"

Parameters
arrayinput array of elements
separatorseperator character(default null)
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( byte[]  array,
string  separator = null 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any.

StringUtils.Join(null, "test") = null

StringUtils.Join(new byte[] { }, "test") = ""

StringUtils.Join(new byte[] { 1, 2, 3 }, ";") = "1;2;3"

StringUtils.Join(new byte[] { 1, 2, 3 }, null) = "123"

Parameters
arrayinput array of elements
separatorseperator character(default null)
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( char[]  array,
string  separator = null 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any.

StringUtils.Join(null, *) = null

StringUtils.Join([], *) = ""

StringUtils.Join([null], *) = ""

StringUtils.Join(['a', 'b', 'c'], ";") = "a;b;c"

StringUtils.Join(['a', 'b', 'c'], null) = "abc"

Parameters
arrayinput array of elements
separatorseperator character(default null)
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( object[]  array,
string  separator,
int  startIndex,
int  noOfItems 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items.

StringUtils.Join(null, *,*,*) = null

StringUtils.Join([], *,*,*) = ""

StringUtils.Join([null], *,*,*) = ""

StringUtils.Join(["a", "b", "c"], ";",0,2) = "a;b"

StringUtils.Join(["a", "b", "c"], null,0,2) = "ab"

Parameters
arrayinput array of elements
separatorseperator character
startIndexthe first index to start joining from.
noOfItemsno.of items to join
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( long[]  array,
string  separator,
int  startIndex,
int  noOfItems 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items.

StringUtils.Join(null, *,*,*) = null

StringUtils.Join([], *,*,*) = ""

StringUtils.Join(["1", "2", "3"], ";",0,2) = "1;2"

StringUtils.Join(["1", "2", "3"], null,0,2) = "12"

Parameters
arrayinput array of elements
separatorseperator character
startIndexthe first index to start joining from.
noOfItemsno.of items to join
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( int[]  array,
string  separator,
int  startIndex,
int  noOfItems 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items.

StringUtils.Join(null, *,*,*) = null

StringUtils.Join([], *,*,*) = ""

StringUtils.Join(["1", "2", "3"], ";",0,2) = "1;2"

StringUtils.Join(["1", "2", "3"], null,0,2) = "12"

Parameters
arrayinput array of elements
separatorseperator character
startIndexthe first index to start joining from.
noOfItemsno.of items to join
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( short[]  array,
string  separator,
int  startIndex,
int  noOfItems 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items.

StringUtils.Join(null, *,*,*) = null

StringUtils.Join([], *,*,*) = ""

StringUtils.Join(["1", "2", "3"], ";",0,2) = "1;2"

StringUtils.Join(["1", "2", "3"], null,0,2) = "12"

Parameters
arrayinput array of elements
separatorseperator character
startIndexthe first index to start joining from.
noOfItemsno.of items to join
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( double[]  array,
string  separator,
int  startIndex,
int  noOfItems 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items.

StringUtils.Join(null, *,*,*) = null

StringUtils.Join([], *,*,*) = ""

StringUtils.Join(["1", "2", "3"], ";",0,2) = "1;2"

StringUtils.Join(["1", "2", "3"], null,0,2) = "12"

Parameters
arrayinput array of elements
separatorseperator character
startIndexthe first index to start joining from.
noOfItemsno.of items to join
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( float[]  array,
string  separator,
int  startIndex,
int  noOfItems 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items.

StringUtils.Join(null, *,*,*) = null

StringUtils.Join([], *,*,*) = ""

StringUtils.Join(["1", "2", "3"], ";",0,2) = "1;2"

StringUtils.Join(["1", "2", "3"], null,0,2) = "12"

Parameters
arrayinput array of elements
separatorseperator character
startIndexthe first index to start joining from.
noOfItemsno.of items to join
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( byte[]  array,
string  separator,
int  startIndex,
int  noOfItems 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items.

StringUtils.Join(null, ";", 1, 2) = null

StringUtils.Join(new byte[] { }, ";", 1, 2) = ""

StringUtils.Join(new byte[] { 1, 2, 3 }, ";", 0, 2) = "1;2"

StringUtils.Join(new byte[] { 1, 2, 3 }, null, 0, 2)= "12"

Parameters
arrayinput array of elements
separatorseperator character
startIndexthe first index to start joining from.
noOfItemsno.of items to join
Returns
the joined String
static string Ultimate.Utilities.StringUtils.Join ( char[]  array,
string  separator,
int  startIndex,
int  noOfItems 
)
static

Joins the elements of the given array into a single String containing the given list of elements using the given seperator if any, and using the start index and no.of items.

StringUtils.Join(null , *,*,*) = null

StringUtils.Join([], *,*,*) = ""

StringUtils.Join(['a', 'b', 'c'], ";",0,2) = "a;b"

StringUtils.Join(['a', 'b', 'c'], null,0,2) = "ab"

Parameters
arrayinput array of elements
separatorseperator character
startIndexthe first index to start joining from.
noOfItemsno.of items to join
Returns
the joined String
static string Ultimate.Utilities.StringUtils.JoinWith ( params object[]  objects)
static

Joins the elements of the given args into a single String containing the provided elements.

StringUtils.JoinWith({"a", "b"}) = "ab"

StringUtils.JoinWith({"a", "1",""}) = "a1"

StringUtils.JoinWith({"a", null, "b"}) = "ab"

StringUtils.JoinWith( {"a", "1"}) = "a1"

Parameters
objectsthe args having the values to join together.
Returns
the joined String
static string Ultimate.Utilities.StringUtils.JoinWith ( string  separator,
params object[]  objects 
)
static

Joins the elements of the given args into a single String containing the provided elements using the given separator.

StringUtils.JoinWith(",", {"a", "b"}) = "a,b"

StringUtils.JoinWith(",", {"a", "1",""}) = "a,1"

StringUtils.JoinWith(",", {"a", null, "b"}) = "a,b"

StringUtils.JoinWith(null, {"a", "1"}) = "a1"

Parameters
separatorseparator character
objectsthe args having the values to join together.
Returns
the joined String
static int Ultimate.Utilities.StringUtils.LastIndexOf ( string  s1,
string  searchValue,
int?  startPos = null 
)
static

Finds the last index of the given string within a string.

StringUtils.LastIndexOf(null, *) = -1

StringUtils.LastIndexOf("", *) = -1

StringUtils.LastIndexOf("aabaabaa", "a") = 7

StringUtils.LastIndexOf("aabaabaa", "ab") = 4

StringUtils.LastIndexOf("aabaabaa", "b", 4) = 2

StringUtils.LastIndexOf("aabaabaa", "b", 7) = 5

Parameters
s1string
searchValuesearch string
startPosstarting position
Returns
index of the string if found or -1
static int Ultimate.Utilities.StringUtils.LastIndexOf ( string  s1,
char  searchValue,
int?  startPos = null 
)
static

Finds the last index of the given char within a string.

StringUtils.LastIndexOf(null, *) = -1

StringUtils.LastIndexOf("", *) = -1

StringUtils.LastIndexOf("aabaabaa", 'a') = 7

StringUtils.LastIndexOf("aabaabaa", 'b', 0) = -1

StringUtils.LastIndexOf("aabaabaa", 'b', 7) = 5

Parameters
s1string
searchValuesearch char
startPosstarting position
Returns
index of the char if found or -1
static int Ultimate.Utilities.StringUtils.LastIndexOfAny ( string  str,
params string[]  searchStrs 
)
static

Searches a string to find the last index of any of the given set of substrings.

StringUtils.LastIndexOfAny(null, *) = -1

StringUtils.LastIndexOfAny(*, null) = -1

StringUtils.LastIndexOfAny(*, []) = -1

StringUtils.LastIndexOfAny(*, [null]) = -1

StringUtils.LastIndexOfAny("zzabyycdxx", "ab","cd") = 6

StringUtils.LastIndexOfAny("zzabyycdxx", "cd","ab") = 6

StringUtils.LastIndexOfAny("zzabyycdxx", "mn","op") = -1

StringUtils.LastIndexOfAny("zzabyycdxx", ["mn","op"]) = -1

StringUtils.LastIndexOfAny("zzabyycdxx", ["mn",""]) = 9

Parameters
strinput string
searchStrssearch strings array
Returns
index if found or -1
static int Ultimate.Utilities.StringUtils.LastIndexOfIgnoreCase ( string  s1,
string  searchValue,
int?  startPos = null 
)
static

Finds the last index of the given string within a string.,ignoring case.

StringUtils.LastIndexOfIgnoreCase(null, *) = -1

StringUtils.LastIndexOfIgnoreCase("", *) = -1

StringUtils.LastIndexOfIgnoreCase("aabaabaa", "A") = 7

StringUtils.LastIndexOfIgnoreCase("aabaabaa", "ab") = 4

StringUtils.LastIndexOfIgnoreCase("aabaabaa", "B", 4) = 2

StringUtils.LastIndexOfIgnoreCase("aabaabaa", "b", 7) = 5

StringUtils.LastIndexOfIgnoreCase("aabaabaa", "b", 9) = -1

Parameters
s1string
searchValuesearch string
startPosstarting position
Returns
index of the string if found or -1
static int Ultimate.Utilities.StringUtils.LastIndexOfIgnoreCase ( string  s1,
char  searchValue,
int?  startPos = null 
)
static

Finds the last index of the given char within a string.,ignoring case.

StringUtils.LastIndexOfIgnoreCase(null, *) = -1

StringUtils.LastIndexOfIgnoreCase("", *) = -1

StringUtils.LastIndexOfIgnoreCase("aabaabaa", 'A') = 7

StringUtils.LastIndexOfIgnoreCase("aabaabaa", 'b', 0) = -1

StringUtils.LastIndexOfIgnoreCase("aabaabaa", 'B', 7) = 5

Parameters
s1string
searchValuesearch char
startPosstarting position
Returns
index of the char if found or -1
static int Ultimate.Utilities.StringUtils.LastOrdinalIndexOf ( string  str,
string  searchValue,
int  ordinal 
)
static

Finds the n-th Last index of the given string within a string.

StringUtils.LastOrdinalIndexOf(null, *, *) = -1

StringUtils.LastOrdinalIndexOf(*, null, *) = -1

StringUtils.LastOrdinalIndexOf("", "", *) = 0

StringUtils.LastOrdinalIndexOf("aabaabaa", "a", 1) = 7

StringUtils.LastOrdinalIndexOf("aabaabaa", "a", 2) = 6

StringUtils.LastOrdinalIndexOf("aabaabaa", "b", 1) = 5

StringUtils.LastOrdinalIndexOf("aabaabaa", "b", 2) = 2

StringUtils.LastOrdinalIndexOf("aabaabaa", "ab", 1) = 4

StringUtils.LastOrdinalIndexOf("aabaabaa", "ab", 2) = 1

StringUtils.LastOrdinalIndexOf("aabaabaa", "", 1) = 8

StringUtils.LastOrdinalIndexOf("aabaabaa", "", 2) = 8

Parameters
strstring
searchValuesearch string
ordinaln-th last index
Returns
index of the string if found or -1
static int Ultimate.Utilities.StringUtils.LastOrdinalIndexOf ( string  str,
char  searchValue,
int  ordinal 
)
static

Finds the n-th Last index of the given char within a string.

StringUtils.LastOrdinalIndexOf(null, *, *) = -1

StringUtils.LastOrdinalIndexOf("aabaabaa", 'a', 1) = 7

StringUtils.LastOrdinalIndexOf("aabaabaa", 'a', 2) = 6

StringUtils.LastOrdinalIndexOf("aabaabaa", 'b', 1) = 5

StringUtils.LastOrdinalIndexOf("aabaabaa", 'b', 2) = 2

Parameters
strstring
searchValuesearch char
ordinaln-th last index
Returns
index of the char if found or -1
static string Ultimate.Utilities.StringUtils.Left ( string  str,
int  len 
)
static

Gets the left most Characters of string.

StringUtils.Left(null, *) = null

StringUtils.Left(*, -1) = "" (-ve length returns Empty string)

StringUtils.Left("", *) = ""

StringUtils.Left("abc", 0) = ""

StringUtils.Left("abc", 2) = "ab"

StringUtils.Left("abc", 4) = "abc"

Parameters
strinput string
lenlength
Returns
string with left most chars
static string Ultimate.Utilities.StringUtils.LeftPad ( string  str,
int  size 
)
static

Left pad a String with spaces (' ').

StringUtils.LeftPad(null, *) = null

StringUtils.LeftPad("", 3) = " "

StringUtils.LeftPad("bat", 3) = "bat"

StringUtils.LeftPad("bat", 5) = " bat"

StringUtils.LeftPad("bat", 1) = "bat"

StringUtils.LeftPad("bat", -1) = "bat"

Parameters
strinput string
sizethe size to pad to
Returns
left padded String or original String if no padding is necessary
static string Ultimate.Utilities.StringUtils.LeftPad ( string  str,
int  size,
char  padChar 
)
static

Left pad a String with a specified character.

StringUtils.LeftPad(null, *, *) = null

StringUtils.LeftPad("", 3, 'z') = "zzz"

StringUtils.LeftPad("bat", 3, 'z') = "bat"

StringUtils.LeftPad("bat", 5, 'z') = "zzbat"

StringUtils.LeftPad("bat", 1, 'z') = "bat"

StringUtils.LeftPad("bat", -1, 'z') = "bat"

Parameters
strinput string
sizethe size to pad to
padCharthe character to pad with
Returns
left padded String or original String if no padding is necessary
static string Ultimate.Utilities.StringUtils.LeftPad ( string  str,
int  size,
string  padStr 
)
static

Left pad a String with a specified String.

StringUtils.LeftPad(null, *, *) = null

StringUtils.LeftPad("", 3, "z") = "zzz"

StringUtils.LeftPad("bat", 3, "yz") = "bat"

StringUtils.LeftPad("bat", 5, "yz") = "yzbat"

StringUtils.LeftPad("bat", 8, "yz") = "yzyzybat"

StringUtils.LeftPad("bat", 1, "yz") = "bat"

StringUtils.LeftPad("bat", -1, "yz") = "bat"

StringUtils.LeftPad("bat", 5, null) = " bat"

StringUtils.LeftPad("bat", 5, "") = " bat"

Parameters
strinput string
sizethe size to pad to
padStrthe string to pad with
Returns
left padded String or original String if no padding is necessary
static int Ultimate.Utilities.StringUtils.Length ( string  str)
static

Gets the length of a string and returns 0 if incase of null input

StringUtils.Length("bat") =3

StringUtils.Length("") =0

StringUtils.Length(null) =0

Parameters
strinput string
Returns
legth of string or 0 if null
static string Ultimate.Utilities.StringUtils.LowerCase ( string  str)
static

Converts a string to lower case

StringUtils.LowerCase(null) = null

StringUtils.LowerCase("") = ""

StringUtils.LowerCase("AbC") = "abc"

Parameters
strinput string
Returns
lowercased string
static string Ultimate.Utilities.StringUtils.Mid ( string  str,
int  pos,
int  len 
)
static

Gets characters from the middle of a string.

StringUtils.Mid(null, *, *) = null

StringUtils.Mid(*, *, -1) = "" (-ve length returns Empty string)

StringUtils.Mid("", 0, *) = ""

StringUtils.Mid("abc", 0, 2) = "ab"

StringUtils.Mid("abc", 0, 4) = "abc"

StringUtils.Mid("abc", 2, 4) = "c"

StringUtils.Mid("abc", 4, 2) = ""

StringUtils.Mid("abc", -2, 2) = "ab"

Parameters
strinput string
posstarting position
lenlegth of the mid string
Returns
string with midlle chars
static string Ultimate.Utilities.StringUtils.NormalizeSpace ( string  str)
static

Removes leading and trailing whitespaces and replaces sequences of whitespace characters by a single space.

StringUtils.NormalizeSpace(null) = null

StringUtils.NormalizeSpace(" apple ") = "apple"

StringUtils.NormalizeSpace(" apple is good for health ") = "apple is good for health"

Parameters
strinput string
Returns
normalized string with proper spaces
static int Ultimate.Utilities.StringUtils.OrdinalIndexOf ( string  str,
string  searchValue,
int  ordinal 
)
static

Finds the n-th index of the given string within a string.

StringUtils.OrdinalIndexOf(null, *, *) = -1

StringUtils.OrdinalIndexOf(*, null, *) = -1

StringUtils.OrdinalIndexOf("", "", *) = 0

StringUtils.OrdinalIndexOf("aabaabaa", "a", 1) = 0

StringUtils.OrdinalIndexOf("aabaabaa", "a", 2) = 1

StringUtils.OrdinalIndexOf("aabaabaa", "b", 1) = 2

StringUtils.OrdinalIndexOf("aabaabaa", "b", 2) = 5

StringUtils.OrdinalIndexOf("aabaabaa", "ab", 1) = 1

StringUtils.OrdinalIndexOf("aabaabaa", "ab", 2) = 4

StringUtils.OrdinalIndexOf("aabaabaa", "", 1) = 0

StringUtils.OrdinalIndexOf("aabaabaa", "", 2) = 0

Parameters
strstring
searchValuesearch string
ordinaln-th index
Returns
index of the string if found or -1
static int Ultimate.Utilities.StringUtils.OrdinalIndexOf ( string  str,
char  searchValue,
int  ordinal 
)
static

Finds the n-th index of the given char within a string.

StringUtils.OrdinalIndexOf(null, *, *) = -1

StringUtils.OrdinalIndexOf("aabaabaa", 'a', 1) = 0

StringUtils.OrdinalIndexOf("aabaabaa", 'a', 2) = 1

StringUtils.OrdinalIndexOf("aabaabaa", 'b', 1) = 2

StringUtils.OrdinalIndexOf("aabaabaa", 'b', 2) = 5

Parameters
strstring
searchValuesearch char
ordinaln-th index
Returns
index of the char if found or -1
static string Ultimate.Utilities.StringUtils.Overlay ( string  str,
string  overlay,
int  start,
int  end 
)
static

Overlays part of a String with another String.

StringUtils.Overlay(null, *, *, *) = null

StringUtils.Overlay("", "abc", 0, 0) = "abc"

StringUtils.Overlay("abcdef", null, 2, 4) = "abef"

StringUtils.Overlay("abcdef", "", 2, 4) = "abef"

StringUtils.Overlay("abcdef", "", 4, 2) = "abef"

StringUtils.Overlay("abcdef", "zzzz", 2, 4) = "abzzzzef"

StringUtils.Overlay("abcdef", "zzzz", 4, 2) = "abzzzzef"

StringUtils.Overlay("abcdef", "zzzz", -1, 4) = "zzzzef"

StringUtils.Overlay("abcdef", "zzzz", 2, 8) = "abzzzz"

StringUtils.Overlay("abcdef", "zzzz", -2, -3) = "zzzzabcdef"

StringUtils.Overlay("abcdef", "zzzz", 8, 10) = "abcdefzzzz"

Parameters
strinput string
overlaystring to overlay
startthe position to start overlaying at
endthe position to stop overlaying before
Returns
overlayed String
static string Ultimate.Utilities.StringUtils.PrependIfMissing ( string  str,
string  prefix,
bool  ignoreCase = false,
ICollection< string >  prefixes = null 
)
static

Prepends the given prefix to the start of the string if the string does not already start with the prefix.

StringUtils.PrependIfMissing(null, null) = null

StringUtils.PrependIfMissing("abc", null) = "abc"

StringUtils.PrependIfMissing("", "xyz") = "xyz"

StringUtils.PrependIfMissing("abc", "xyz") = "xyzabc"

StringUtils.PrependIfMissing("xyzabc", "xyz") = "xyzabc"

StringUtils.PrependIfMissing("XYZabc", "xyz") = "xyzXYZabc"

StringUtils.PrependIfMissing(null, null, true) = null

StringUtils.PrependIfMissing("abc", null, false) = "abc"

StringUtils.PrependIfMissing("", "xyz", false) = "xyz"

StringUtils.PrependIfMissing("abc", "xyz",false, {null}) = "xyzabc"

StringUtils.PrependIfMissing("abc", "xyz",false, {""}) = "abc"

StringUtils.PrependIfMissing("abc", "xyz",false, {"mno"}) = "xyzabc"

StringUtils.PrependIfMissing("xyzabc", "xyz",false, {"mno"}) = "xyzabc"

StringUtils.PrependIfMissing("mnoabc", "xyz",false, {"mno"}) = "mnoabc"

StringUtils.PrependIfMissing("XYZabc", "xyz",false, {"mno"}) = "xyzXYZabc"

StringUtils.PrependIfMissing("MNOabc", "xyz",false, {"mno"}) = "xyzMNOabc"

Parameters
strinput string
prefixprefix to add at the start of the string
ignoreCaseis case ignored? (default false)
prefixesarray of prefixes. Once a prefix is found others will be terminated (default null)
Returns
string with prefix added if it doesn't already has it
static string Ultimate.Utilities.StringUtils.PrependIfMissingIgnoreCase ( string  str,
string  prefix,
string[]  prefixes = null 
)
static

Prepends the given prefix to the start of the string if the string does not already start with the prefix. Ignores the casing while searching for the prefix.

StringUtils.PrependIfMissingIgnoreCase(null, null) = null

StringUtils.PrependIfMissingIgnoreCase("abc", null) = "abc"

StringUtils.PrependIfMissingIgnoreCase("", "xyz") = "xyz"

StringUtils.PrependIfMissingIgnoreCase("abc", "xyz") = "xyzabc"

StringUtils.PrependIfMissingIgnoreCase("xyzabc", "xyz") = "xyzabc"

StringUtils.PrependIfMissingIgnoreCase("XYZabc", "xyz") = "XYZabc"

StringUtils.PrependIfMissingIgnoreCase(null, null, null) = null

StringUtils.PrependIfMissingIgnoreCase("abc", null, null) = "abc"

StringUtils.PrependIfMissingIgnoreCase("", "xyz", null) = "xyz"

StringUtils.PrependIfMissingIgnoreCase("abc", "xyz", {null}) = "xyzabc"

StringUtils.PrependIfMissingIgnoreCase("abc", "xyz",{ ""}) = "abc"

StringUtils.PrependIfMissingIgnoreCase("abc", "xyz", {"mno"}) = "xyzabc"

StringUtils.PrependIfMissingIgnoreCase("xyzabc", "xyz", {"mno"}) = "xyzabc"

StringUtils.PrependIfMissingIgnoreCase("mnoabc", "xyz", {"mno"}) = "mnoabc"

StringUtils.PrependIfMissingIgnoreCase("XYZabc", "xyz", {"mno"}) = "XYZabc"

StringUtils.PrependIfMissingIgnoreCase("MNOabc", "xyz", {"mno"}) = "MNOabc"

Parameters
strinput string
prefixprefix to add at the start of the string
prefixesarray of prefixes. Once a prefix is found others will be terminated (default null)
Returns
string with prefix added if it doesn't already has it
static string Ultimate.Utilities.StringUtils.Remove ( string  str,
string  remove 
)
static

Removes all occurences of the substring from within the input string.

StringUtils.Remove(null, *) = null

StringUtils.Remove("", *) = ""

StringUtils.Remove(*, null) = *

StringUtils.Remove(*, "") = *

StringUtils.Remove("queued", "ue") = "qd"

StringUtils.Remove("queued", "zz") = "queued"

Parameters
strinput string
removesubstring to remove
Returns
the substring with the string removed if found
static string Ultimate.Utilities.StringUtils.Remove ( string  str,
char  remove 
)
static

Removes all occurences of a character from within the input string.

StringUtils.Remove(null, *) = null

StringUtils.Remove("", *) = ""

StringUtils.Remove("queued", 'u') = "qeed"

StringUtils.Remove("queued", 'z') = "queued"

Parameters
strinput string
removesubstring to remove
Returns
the substring with the string removed if found
static string Ultimate.Utilities.StringUtils.RemoveEnd ( string  str,
string  remove 
)
static

Removes a substring only if it is at the end of the input string, otherwise returns the original string.

StringUtils.RemoveEnd(null, *) = null

StringUtils.RemoveEnd("", *) = ""

StringUtils.RemoveEnd(*, null) = *

StringUtils.RemoveEnd("www.xyz.com", ".com.") = "www.xyz.com"

StringUtils.RemoveEnd("www.xyz.com", ".com") = "www.xyz"

StringUtils.RemoveEnd("www.xyz.com", "xyz") = "www.xyz.com"

StringUtils.RemoveEnd("abc", "") = "abc"

Parameters
strinput string
removesubstring to remove
Returns
the substring with the string removed if found
static string Ultimate.Utilities.StringUtils.RemoveEndIgnoreCase ( string  str,
string  remove 
)
static

By ignoring case.,Removes a substring only if it is at the end of the input string , otherwise returns the original string.

StringUtils.RemoveEndIgnoreCase(null, *) = null

StringUtils.RemoveEndIgnoreCase("", *) = ""

StringUtils.RemoveEndIgnoreCase(*, null) = *

StringUtils.RemoveEndIgnoreCase("www.xyz.com", ".com.") = "www.xyz.com"

StringUtils.RemoveEndIgnoreCase("www.xyz.com", ".com") = "www.xyz"

StringUtils.RemoveEndIgnoreCase("www.xyz.com", "xyz") = "www.xyz.com"

StringUtils.RemoveEndIgnoreCase("abc", "") = "abc"

StringUtils.RemoveEndIgnoreCase("www.xyz.com", ".COM") = "www.xyz"

StringUtils.RemoveEndIgnoreCase("www.xyz.COM", ".com") = "www.xyz"

Parameters
strinput string
removesubstring to remove
Returns
the substring with the string removed if found
static string Ultimate.Utilities.StringUtils.RemovePattern ( string  source,
string  regex 
)
static

Removes All regular expression matches inside a larger String.

StringUtils.RemovePattern(null, *) = null

StringUtils.RemovePattern("", *) = ""

StringUtils.RemovePattern("any", null) = "any"

StringUtils.RemovePattern("any", "") = "any"

StringUtils.RemovePattern("something/satish049@gmail.com/xyz", "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)") = "something//xyz"

Parameters
sourceinput string
regexregular expression to match
Returns
the text with patterns removed if any
static string Ultimate.Utilities.StringUtils.RemoveStart ( string  str,
string  remove 
)
static

Removes a substring only if it is at the beginning of the input string, otherwise returns the original string.

StringUtils.RemoveStart(null, *) = null

StringUtils.RemoveStart("", *) = ""

StringUtils.RemoveStart(*, null) = *

StringUtils.RemoveStart("www.xyz.com", "www.") = "xyz.com"

StringUtils.RemoveStart("xyz.com", "www.") = "xyz.com"

StringUtils.RemoveStart("www.xyz.com", "xyz") = "www.xyz.com"

StringUtils.RemoveStart("abc", "") = "abc"

Parameters
strinput string
removesubstring to remove
Returns
the substring with the string removed if found
static string Ultimate.Utilities.StringUtils.RemoveStartIgnoreCase ( string  str,
string  remove 
)
static

By ignoring case.,Removes a substring only if it is at the beginning of the input string , otherwise returns the original string.

StringUtils.RemoveStartIgnoreCase(null, *) = null

StringUtils.RemoveStartIgnoreCase("", *) = ""

StringUtils.RemoveStartIgnoreCase(*, null) = *

StringUtils.RemoveStartIgnoreCase("www.xyz.com", "www.") = "xyz.com"

StringUtils.RemoveStartIgnoreCase("www.xyz.com", "WWW.") = "xyz.com"

StringUtils.RemoveStartIgnoreCase("xyz.com", "www.") = "xyz.com"

StringUtils.RemoveStartIgnoreCase("www.xyz.com", "xyz") = "www.xyz.com"

StringUtils.RemoveStartIgnoreCase("abc", "") = "abc"

Parameters
strinput string
removesubstring to remove
Returns
the substring with the string removed if found
static string Ultimate.Utilities.StringUtils.Repeat ( string  str,
int  repeat 
)
static

Repeat a String n times to form a new String.

StringUtils.Repeat(null, 2) = null

StringUtils.Repeat("", 0) = ""

StringUtils.Repeat("", 2) = ""

StringUtils.Repeat("a", 3) = "aaa"

StringUtils.Repeat("ab", 2) = "abab"

StringUtils.Repeat("a", -2) = ""

Parameters
strstring to repeat
repeatno.of times to repeat
Returns
a new repeated string
static string Ultimate.Utilities.StringUtils.Repeat ( string  str,
string  separator,
int  repeat 
)
static

Repeat a String n times to form a new String.,with a string separator added in between

StringUtils.Repeat(null, null, 2) = null

StringUtils.Repeat(null, "x", 2) = null

StringUtils.Repeat("", null, 0) = ""

StringUtils.Repeat("", "", 2) = ""

StringUtils.Repeat("x", "", 3) = "xxx"

StringUtils.Repeat("?", ", ", 3) = "?, ?, ?"

Parameters
strstring to repeat
separatorseparator to be added
repeatno.of times to repeat
Returns
a new repeated string
static string Ultimate.Utilities.StringUtils.Repeat ( char  ch,
int  repeat 
)
static

Repeat a character n times to form a new String.

StringUtils.Repeat('e', 0) = ""

StringUtils.Repeat('e', 3) = "eee"

StringUtils.Repeat('e', -2) = ""

Parameters
chcharacter to repeat
repeatno.of times to repeat
Returns
a new repeated string
static string Ultimate.Utilities.StringUtils.Replace ( string  text,
string  searchString,
string  replacement 
)
static

Replaces all occurrences of a String within another String.

StringUtils.Replace(null, *, *) = null

StringUtils.Replace("", *, *) = ""

StringUtils.Replace("any", null, *) = "any"

StringUtils.Replace("any", *, null) = "any"

StringUtils.Replace("any", "", *) = "any"

StringUtils.Replace("aba", "a", null) = "aba"

StringUtils.Replace("aba", "a", "") = "b"

StringUtils.Replace("aba", "a", "z") = "zbz"

Parameters
textinput text
searchStringstring to find
replacementstring to replace
Returns
the text with replacements if any
static string Ultimate.Utilities.StringUtils.Replace ( string  text,
string  searchString,
string  replacement,
int  max 
)
static

Replaces all occurrences of a String within another String.,for the first max values of the search string.

StringUtils.Replace(null, *, *, *) = null

StringUtils.Replace("", *, *, *) = ""

StringUtils.Replace("any", null, *, *) = "any"

StringUtils.Replace("any", *, null, *) = "any"

StringUtils.Replace("any", "", *, *) = "any"

StringUtils.Replace("any", *, *, 0) = "any"

StringUtils.Replace("abaa", "a", null, -1) = "abaa"

StringUtils.Replace("abaa", "a", "", -1) = "b"

StringUtils.Replace("abaa", "a", "z", 0) = "abaa"

StringUtils.Replace("abaa", "a", "z", 1) = "zbaa"

StringUtils.Replace("abaa", "a", "z", 2) = "zbza"

StringUtils.Replace("abaa", "a", "z", -1) = "zbzz"

Parameters
textinput text
searchStringstring to find
replacementstring to replace
maxmaximum number of values to replace
Returns
the text with replacements if any
static string Ultimate.Utilities.StringUtils.ReplaceChars ( string  str,
char  searchChar,
char  replaceChar 
)
static

Replaces all occurrences of a character within another String

StringUtils.ReplaceChars(null, *, *) = null

StringUtils.ReplaceChars("", *, *) = ""

StringUtils.ReplaceChars("abcba", 'b', 'y') = "aycya"

StringUtils.ReplaceChars("abcba", 'z', 'y') = "abcba"

Parameters
strinput string
searchCharchar to search for
replaceCharchar to replace with
Returns
text with replacements if any
static string Ultimate.Utilities.StringUtils.ReplaceChars ( string  str,
string  searchChars,
string  replaceChars 
)
static

Replaces multiple characters of a string within another string

StringUtils.ReplaceChars(null, *, *) = null

StringUtils.ReplaceChars("", *, *) = ""

StringUtils.ReplaceChars("abc", null, *) = "abc"

StringUtils.ReplaceChars("abc", "", *) = "abc"

StringUtils.ReplaceChars("abc", "b", null) = "ac"

StringUtils.ReplaceChars("abc", "b", "") = "ac"

StringUtils.ReplaceChars("abcba", "bc", "yz") = "ayzya"

StringUtils.ReplaceChars("abcba", "bc", "y") = "ayya"

StringUtils.ReplaceChars("abcba", "bc", "yzx") = "ayzya"

Parameters
strinput string
searchCharschars to search for
replaceCharschars to replace with
Returns
text with replacements if any
static string Ultimate.Utilities.StringUtils.ReplaceEach ( string  text,
string[]  searchList,
string[]  replacementList 
)
static

Replaces all occurrences of Strings within another String.

StringUtils.ReplaceEach(null, *, *) = null

StringUtils.ReplaceEach("", *, *) = ""

StringUtils.ReplaceEach("aba", null, null) = "aba"

StringUtils.ReplaceEach("aba", new String[0], null) = "aba"

StringUtils.ReplaceEach("aba", null, new String[0]) = "aba"

StringUtils.ReplaceEach("aba", new String[]{"a"}, null) = "aba"

StringUtils.ReplaceEach("aba", new String[]{"a"}, new String[]{""}) = "b"

StringUtils.ReplaceEach("aba", new String[]{null}, new String[]{"a"}) = "aba"

StringUtils.ReplaceEach("abcde", new String[]{"ab", "d"}, new String[]{"w", "t"}) = "wcte"

Parameters
texttext to search and replace in, no operation if null
searchListthe Strings to search for, no operation if null
replacementListthe Strings to replace them with, no operation if null
Returns
the text with replacements if any
static string Ultimate.Utilities.StringUtils.ReplaceEachRepeatedly ( string  text,
string[]  searchList,
string[]  replacementList 
)
static

Replaces all occurrences of Strings within another String in a repeated way.

StringUtils.ReplaceEachRepeatedly(null, *, *) = null

StringUtils.ReplaceEachRepeatedly("", *, *) = ""

StringUtils.ReplaceEachRepeatedly("aba", null, null) = "aba"

StringUtils.ReplaceEachRepeatedly("aba", new String[0], null) = "aba"

StringUtils.ReplaceEachRepeatedly("aba", null, new String[0]) = "aba"

StringUtils.ReplaceEachRepeatedly("aba", new String[]{"a"}, null) = "aba"

StringUtils.ReplaceEachRepeatedly("aba", new String[]{"a"}, new String[]{""}) = "b"

StringUtils.ReplaceEachRepeatedly("aba", new String[]{null}, new String[]{"a"}) = "aba"

StringUtils.ReplaceEachRepeatedly("abcde", new String[]{"ab", "d"}, new String[]{"w", "t"}) = "wcte"

Parameters
texttext to search and replace in, no operation if null
searchListthe Strings to search for, no operation if null
replacementListthe Strings to replace them with, no operation if null
Returns
the text with replacements if any
static string Ultimate.Utilities.StringUtils.ReplaceOnce ( string  text,
string  searchString,
string  replacement 
)
static

Replaces a String with another String inside a larger String, once.

StringUtils.ReplaceOnce(null, *, *) = null

StringUtils.ReplaceOnce("", *, *) = ""

StringUtils.ReplaceOnce("any", null, *) = "any"

StringUtils.ReplaceOnce("any", *, null) = "any"

StringUtils.ReplaceOnce("any", "", *) = "any"

StringUtils.ReplaceOnce("aba", "a", null) = "aba"

StringUtils.ReplaceOnce("aba", "a", "") = "ba"

StringUtils.ReplaceOnce("aba", "a", "z") = "zba"

Parameters
textinput string
searchStringstring to find
replacementstring to replace
Returns
the text with replacements if any
static string Ultimate.Utilities.StringUtils.ReplacePattern ( string  source,
string  regex,
string  replacement,
bool  ignoreCase = false 
)
static

Replaces All regular expression matches with another String inside a larger String.

StringUtils.ReplacePattern(null, *, *) = null

StringUtils.ReplacePattern("", *, *) = ""

StringUtils.ReplacePattern("any", null, *) = "any"

StringUtils.ReplacePattern("any", *, null) = "any"

StringUtils.ReplacePattern("any", "", *) = "any"

StringUtils.ReplacePattern("something/satish049@gmail.com/xyz", "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)","NoEmail") = "something/NoEmail/xyz"

Parameters
sourceinput string
regexregular expression to match
replacementstring to replace
ignoreCasetrue if the ignore case (default false)
Returns
the text with replacements if any
static string Ultimate.Utilities.StringUtils.Reverse ( string  str)
static

Reverses a string

StringUtils.Reverse(null) = null

StringUtils.Reverse("") = ""

StringUtils.Reverse("bat") = "tab"

Parameters
strinput string
Returns
reversed string
static string Ultimate.Utilities.StringUtils.ReverseDelimited ( string  str,
char  separatorChar 
)
static

Reverses a String that is delimited by a specific character.

para>

StringUtils.ReverseDelimited(null, *) = null

StringUtils.ReverseDelimited("", *) = ""

StringUtils.ReverseDelimited("a.b.c", 'x') = "a.b.c"

StringUtils.ReverseDelimited("a.b.c", '.') = "c.b.a"

Parameters
strinput string
separatorCharthe seperator character to use
Returns
reversed string
static string Ultimate.Utilities.StringUtils.Right ( string  str,
int  len 
)
static

Gets the right most Characters of string.

StringUtils.Right(null, *) = null

StringUtils.Right(*, -1) = "" (-ve length returns Empty string)

StringUtils.Right("", *) = ""

StringUtils.Right("abc", 0) = ""

StringUtils.Right("abc", 2) = "bc"

StringUtils.Right("abc", 4) = "abc"

Parameters
strinput string
lenlength
Returns
string with right most chars
static string Ultimate.Utilities.StringUtils.RightPad ( string  str,
int  size 
)
static

Right pad a String with spaces (' ').

StringUtils.RightPad(null, *) = null

StringUtils.RightPad("", 3) = " "

StringUtils.RightPad("bat", 3) = "bat"

StringUtils.RightPad("bat", 5) = "bat "

StringUtils.RightPad("bat", 1) = "bat"

StringUtils.RightPad("bat", -1) = "bat"

Parameters
strthe String to pad out
sizethe size to pad to
Returns
right padded String or original String if no padding is necessary
static string Ultimate.Utilities.StringUtils.RightPad ( string  str,
int  size,
char  padChar 
)
static

Right pad a String with a specified character.

StringUtils.RightPad(null, *, *) = null

StringUtils.RightPad("", 3, 'z') = "zzz"

StringUtils.RightPad("bat", 3, 'z') = "bat"

StringUtils.RightPad("bat", 5, 'z') = "batzz"

StringUtils.RightPad("bat", 1, 'z') = "bat"

StringUtils.RightPad("bat", -1, 'z') = "bat"

Parameters
strinput string
sizethe size to pad to
padCharthe character to pad with
Returns
right padded String or original String if no padding is necessary
static string Ultimate.Utilities.StringUtils.RightPad ( string  str,
int  size,
string  padStr 
)
static

Right pad a String with a specified String.

StringUtils.RightPad(null, *, *) = null

StringUtils.RightPad("", 3, "z") = "zzz"

StringUtils.RightPad("bat", 3, "yz") = "bat"

StringUtils.RightPad("bat", 5, "yz") = "batyz"

StringUtils.RightPad("bat", 8, "yz") = "batyzyzy"

StringUtils.RightPad("bat", 1, "yz") = "bat"

StringUtils.RightPad("bat", -1, "yz") = "bat"

StringUtils.RightPad("bat", 5, null) = "bat "

StringUtils.RightPad("bat", 5, "") = "bat "

Parameters
strinput string
sizethe size to pad to
padStrthe string to pad with
Returns
right padded String or original String if no padding is necessary
static string Ultimate.Utilities.StringUtils.Rotate ( string  str,
int  shift 
)
static

Rotate a string of characters

StringUtils.Rotate(null, *) = null

StringUtils.Rotate("", *) = ""

StringUtils.Rotate("abcdefg", 0) = "abcdefg"

StringUtils.Rotate("abcdefg", 2) = "fgabcde"

StringUtils.Rotate("abcdefg", -2) = "cdefgab"

StringUtils.Rotate("abcdefg", 7) = "abcdefg"

StringUtils.Rotate("abcdefg", -7) = "abcdefg"

StringUtils.Rotate("abcdefg", 9) = "fgabcde"

StringUtils.Rotate("abcdefg", -9) = "cdefgab"

Parameters
strinput string
shiftnumber of times to shift
Returns
Rotated string
static string [] Ultimate.Utilities.StringUtils.Split ( string  str)
static

Splits the given string into an array, using whitespace as the separator.

StringUtils.Split(null) = null

StringUtils.Split("") = []

StringUtils.Split("abc def") = ["abc", "def"]

StringUtils.Split("abc def") = ["abc", "def"]

StringUtils.Split(" abc ") = ["abc"]

Parameters
strinput string
Returns
an array of parsed Strings
static string [] Ultimate.Utilities.StringUtils.Split ( string  str,
char  separatorChar 
)
static

Splits the given string into an array, using the specified separator.

StringUtils.Split(null, *) = null

StringUtils.Split("", *) = []

StringUtils.Split("a.b.c", '.') = ["a", "b", "c"]

StringUtils.Split("a..b.c", '.') = ["a", "b", "c"]

StringUtils.Split("a:b:c", '.') = ["a:b:c"]

StringUtils.Split("a b c", ' ') = ["a", "b", "c"]

Parameters
strinput string
separatorCharthe character used as the delimiter
Returns
an array of parsed Strings
static string [] Ultimate.Utilities.StringUtils.Split ( string  str,
string  separatorChars 
)
static

Splits the given string into an array, using the specified separators.

StringUtils.Split(null, *) = null

StringUtils.Split("", *) = []

StringUtils.Split("abc def", null) = ["abc", "def"]

StringUtils.Split("abc def", " ") = ["abc", "def"]

StringUtils.Split("abc def", " ") = ["abc", "def"]

StringUtils.Split("ab:cd:ef", ":") = ["ab", "cd", "ef"]

Parameters
strinput string
separatorCharsthe characters used as the delimiter
Returns
an array of parsed Strings
static string [] Ultimate.Utilities.StringUtils.Split ( string  str,
string  separatorChars,
int  max 
)
static

Splits the given string into an array with max length, using the specified separator string.

StringUtils.Split(null, *, *) = null

StringUtils.Split("", *, *) = []

StringUtils.Split("ab cd ef", null, 0) = ["ab", "cd", "ef"]

StringUtils.Split("ab cd ef", null, 0) = ["ab", "cd", "ef"]

StringUtils.Split("ab:cd:ef", ":", 0) = ["ab", "cd", "ef"]

StringUtils.Split("ab:cd:ef", ":", 2) = ["ab", "cd:ef"]

Parameters
strinput string
separatorCharsthe characters used as the delimiter
maxmax number of elements to include in the array.A zero or negative value implies no limit
Returns
an array of parsed Strings
static string [] Ultimate.Utilities.StringUtils.SplitByCharacterType ( string  str)
static

Splits a String by Character type

StringUtils.SplitByCharacterType(null) = null

StringUtils.SplitByCharacterType("") = []

StringUtils.SplitByCharacterType("ab de fg") = ["ab", " ", "de", " ", "fg"]

StringUtils.SplitByCharacterType("ab de fg") = ["ab", " ", "de", " ", "fg"]

StringUtils.SplitByCharacterType("ab:cd:ef") = ["ab", ":", "cd", ":", "ef"]

StringUtils.SplitByCharacterType("number5") = ["number", "5"]

StringUtils.SplitByCharacterType("fooBar") = ["foo", "B", "ar"]

StringUtils.SplitByCharacterType("foo200Bar") = ["foo", "200", "B", "ar"]

StringUtils.SplitByCharacterType("ASFRules") = ["ASFR", "ules"]

Parameters
strinput string
Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitByCharacterTypeCamelCase ( string  str)
static

Splits a String by Character type.the character of CamelCase type , if any, immediately preceding a token of type LowerCase will belong to the following token rather than to the preceding.See the examples.

StringUtils.SplitByCharacterTypeCamelCase(null) = null

StringUtils.SplitByCharacterTypeCamelCase("") = []

StringUtils.SplitByCharacterTypeCamelCase("ab de fg") = ["ab", " ", "de", " ", "fg"]

StringUtils.SplitByCharacterTypeCamelCase("ab de fg") = ["ab", " ", "de", " ", "fg"]

StringUtils.SplitByCharacterTypeCamelCase("ab:cd:ef") = ["ab", ":", "cd", ":", "ef"]

StringUtils.SplitByCharacterTypeCamelCase("number5") = ["number", "5"]

StringUtils.SplitByCharacterTypeCamelCase("fooBar") = ["foo", "Bar"]

StringUtils.SplitByCharacterTypeCamelCase("foo200Bar") = ["foo", "200", "Bar"]

StringUtils.SplitByCharacterTypeCamelCase("ASFRules") = ["ASF", "Rules"]

Parameters
strinput string
Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitByWholeSeparator ( string  str,
string  separator 
)
static

Splits the provided text into an array, using the specified separator string.

StringUtils.SplitByWholeSeparator(null, *) = null

StringUtils.SplitByWholeSeparator("", *) = []

StringUtils.SplitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"]

StringUtils.SplitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"]

StringUtils.SplitByWholeSeparator("ab:cd:ef", ":") = ["ab", "cd", "ef"]

StringUtils.SplitByWholeSeparator("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"]

Parameters
strinput string
separatorseperator string
Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitByWholeSeparator ( string  str,
string  separator,
int  max 
)
static

Splits the provided text into an array with max length, using the specified separator string.

StringUtils.SplitByWholeSeparator(null, *) = null

StringUtils.SplitByWholeSeparator("", *) = []

StringUtils.SplitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"]

StringUtils.SplitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"]

StringUtils.SplitByWholeSeparator("ab:cd:ef", ":") = ["ab", "cd", "ef"]

StringUtils.SplitByWholeSeparator("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"]

Parameters
strinput string
separatorseperator string
maxmax number of elements to include in the array.A zero or negative value implies no limit
Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitByWholeSeparatorPreserveAllTokens ( string  str,
string  separator 
)
static

Splits the provided text into an array, using the specified separator string.Adjacent separators are treated as separators for empty tokens.

StringUtils.SplitByWholeSeparatorPreserveAllTokens(null, *) = null

StringUtils.SplitByWholeSeparatorPreserveAllTokens("", *) = []

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab de fg", null) = ["ab", "de", "fg"]

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab de fg", null) = ["ab", "", "", "de", "fg"]

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab:cd:ef", ":") = ["ab", "cd", "ef"]

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"]

Parameters
strinput string
separatorseperator string
Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitByWholeSeparatorPreserveAllTokens ( string  str,
string  separator,
int  max 
)
static

Splits the provided text into an array with max length, using the specified separator string.Adjacent separators are treated as separators for empty tokens.

StringUtils.SplitByWholeSeparatorPreserveAllTokens(null, *, *) = null

StringUtils.SplitByWholeSeparatorPreserveAllTokens("", *, *) = []

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab de fg", null, 0) = ["ab", "de", "fg"]

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab de fg", null, 0) = ["ab", "", "", "de", "fg"]

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab:cd:ef", ":", 2) = ["ab", "cd:ef"]

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab-!-cd-!-ef", "-!-", 5) = ["ab", "cd", "ef"]

StringUtils.SplitByWholeSeparatorPreserveAllTokens("ab-!-cd-!-ef", "-!-", 2) = ["ab", "cd-!-ef"]

Parameters
strinput string
separatorseperator string
maxmax number of elements to include in the array.A zero or negative value implies no limit

k

Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitPreserveAllTokens ( string  str)
static

Splits the given string into an array, using whitespace as the separator, preserving all tokens, including empty tokens created by adjacent separators.

StringUtils.SplitPreserveAllTokens(null) = null

StringUtils.SplitPreserveAllTokens("") = []

StringUtils.SplitPreserveAllTokens("abc def") = ["abc", "def"]

StringUtils.SplitPreserveAllTokens("abc def") = ["abc", "", "def"]

StringUtils.SplitPreserveAllTokens(" abc ") = ["", "abc", ""]

Parameters
strinput string
Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitPreserveAllTokens ( string  str,
char  separatorChar 
)
static

Splits the provided text into an array, using the specified separator, preserving all tokens, including empty tokens created by adjacent separators.

StringUtils.SplitPreserveAllTokens(null, *) = null

StringUtils.SplitPreserveAllTokens("", *) = []

StringUtils.SplitPreserveAllTokens("a.b.c", '.') = ["a", "b", "c"]

StringUtils.SplitPreserveAllTokens("a..b.c", '.') = ["a", "", "b", "c"]

StringUtils.SplitPreserveAllTokens("a:b:c", '.') = ["a:b:c"]

StringUtils.SplitPreserveAllTokens("a b c", ' ') = ["a", "b", "c"]

StringUtils.SplitPreserveAllTokens("a b c ", ' ') = ["a", "b", "c", ""]

StringUtils.SplitPreserveAllTokens("a b c ", ' ') = ["a", "b", "c", "", ""]

StringUtils.SplitPreserveAllTokens(" a b c", ' ') = ["", "a", "b", "c"]

StringUtils.SplitPreserveAllTokens(" a b c", ' ') = ["", "", a", "b", "c"] <para/> StringUtils.SplitPreserveAllTokens(" a b c ", ' ') = ["", "a", "b", "c", ""]

Parameters
strinput string
separatorCharthe character used as the delimiter
Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitPreserveAllTokens ( string  str,
string  separatorChars 
)
static

Splits the provided text into an array, using the specified separator, preserving all tokens, including empty tokens created by adjacent separators.

StringUtils.SplitPreserveAllTokens(null, *) = null

StringUtils.SplitPreserveAllTokens("", *) = []

StringUtils.SplitPreserveAllTokens("abc def", null) = ["abc", "def"]

StringUtils.SplitPreserveAllTokens("abc def", " ") = ["abc", "def"]

StringUtils.SplitPreserveAllTokens("abc def", " ") = ["abc", "", "def"]

StringUtils.SplitPreserveAllTokens("ab:cd:ef", ":") = ["ab", "cd", "ef"]

StringUtils.SplitPreserveAllTokens("ab:cd:ef:", ":") = ["ab", "cd", "ef", ""]

StringUtils.SplitPreserveAllTokens("ab:cd:ef::", ":") = ["ab", "cd", "ef", "", ""]

StringUtils.SplitPreserveAllTokens("ab::cd:ef", ":") = ["ab", "", "cd", "ef"]

StringUtils.SplitPreserveAllTokens(":cd:ef", ":") = ["", "cd", "ef"]

StringUtils.SplitPreserveAllTokens("::cd:ef", ":") = ["", "", "cd", "ef"]

StringUtils.SplitPreserveAllTokens(":cd:ef:", ":") = ["", "cd", "ef", ""]

Parameters
strinput string
separatorCharsthe characters used as the delimiters
Returns
an array of parsed strings
static string [] Ultimate.Utilities.StringUtils.SplitPreserveAllTokens ( string  str,
string  separatorChars,
int  max 
)
static

Splits the provided text into an array with max length, using the specified separator, preserving all tokens, including empty tokens created by adjacent separators.

StringUtils.SplitPreserveAllTokens(null, *, *) = null

StringUtils.SplitPreserveAllTokens("", *, *) = []

StringUtils.SplitPreserveAllTokens("ab de fg", null, 0) = ["ab", "de", "fg"]

StringUtils.SplitPreserveAllTokens("ab de fg", null, 0) = ["ab","", "de", "fg"]

StringUtils.SplitPreserveAllTokens("ab:cd:ef", ":", 0) = ["ab", "cd", "ef"]

StringUtils.SplitPreserveAllTokens("ab:cd:ef", ":", 2) = ["ab", "cd:ef"]

StringUtils.SplitPreserveAllTokens("ab de fg", null, 2) = ["ab", " de fg"]

StringUtils.SplitPreserveAllTokens("ab de fg", null, 3) = ["ab", "", " de fg"]

StringUtils.SplitPreserveAllTokens("ab de fg", null, 4) = ["ab", "", "", "de fg"]

Parameters
strinput string
separatorCharsthe characters used as the delimiters
maxmax number of elements to include in the array.A zero or negative value implies no limit

k

Returns
an array of parsed strings
static bool Ultimate.Utilities.StringUtils.StartsWith ( string  str,
string  prefix,
bool  ignoreCase = false 
)
static

Checks if a string starts with a specified prefix.

StringUtils.StartsWith(null, null) = true

StringUtils.StartsWith(null, "abc") = false

StringUtils.StartsWith("abcdef", null) = false

StringUtils.StartsWith("abcdef", "abc") = true

StringUtils.StartsWith("ABCDEF", "abc") = false

Parameters
strinput string
prefixthe prefix to find
ignoreCaseis case ignored? (default false)
Returns
true or false
static bool Ultimate.Utilities.StringUtils.StartsWithAny ( string  str,
bool  ignoreCase,
params string[]  searchStrings 
)
static

Checks if a string starts with any of an array of specified strings.

StringUtils.StartsWithAny(null, null) = false

StringUtils.StartsWithAny(null, new String[] {"abc"}) = false

StringUtils.StartsWithAny("abcxyz", null) = false

StringUtils.StartsWithAny("abcxyz", new String[] {""}) = true

StringUtils.StartsWithAny("abcxyz", new String[] {"abc"}) = true

StringUtils.StartsWithAny("abcxyz", new String[] {null, "xyz", "abc"}) = true

Parameters
strinput string
ignoreCaseis case ignored?
searchStringsarray of prefix search strings
Returns
true or false
static bool Ultimate.Utilities.StringUtils.StartsWithIgnoreCase ( string  str,
string  prefix 
)
static

Checks if a string starts with a specified prefix by ignoring case.

StringUtils.StartsWithIgnoreCase(null, null) = true

StringUtils.StartsWithIgnoreCase(null, "abc") = false

StringUtils.StartsWithIgnoreCase("abcdef", null) = false

StringUtils.StartsWithIgnoreCase("abcdef", "abc") = true

StringUtils.StartsWithIgnoreCase("ABCDEF", "abc") = true

Parameters
strinput string
prefixthe prefix to find
Returns
true or false
static string Ultimate.Utilities.StringUtils.Strip ( string  str,
string  stripChars = null 
)
static

Strips whitespace or the given set of chars from the start and end of a String

StringUtils.Strip(null) = null

StringUtils.Strip("") = ""

StringUtils.Strip(" ") = ""

StringUtils.Strip("abc") = "abc"

StringUtils.Strip(" abc") = "abc"

StringUtils.Strip("abc ") = "abc"

StringUtils.Strip(" abc ") = "abc"

StringUtils.Strip(" ab c ") = "ab c"

Parameters
strinput string
stripCharsChars to be stripped
Returns
string
static string Ultimate.Utilities.StringUtils.StripAccents ( string  input)
static

Removes diacritics (~= accents) from a string. The case will not be altered

StringUtils.StripAccents(null) = null

StringUtils.StripAccents("") = ""

StringUtils.StripAccents("control") = "control"

StringUtils.StripAccents("Å atish") = "Satish"

Parameters
inputinput string
Returns
String
static string [] Ultimate.Utilities.StringUtils.StripAll ( params string[]  strs)
static

Strips whitespace from the start and end of every String in an array.

StringUtils.StripAll(null) = null

StringUtils.StripAll([]) = []

StringUtils.StripAll("abc", " abc") = ["abc", "abc"]

StringUtils.StripAll("abc ", null) = ["abc", null]

StringUtils.StripAll(["xyz", " abc"]) = ["xyz", "abc"]

Parameters
strsinput strings
Returns
result strings array
static string [] Ultimate.Utilities.StringUtils.StripAll ( string[]  strs,
string  stripChars = null 
)
static

Strips the given set of Chars from the start and end of every string in an array.

StringUtils.StripAll(null, *) = null

StringUtils.StripAll([], *) = []

StringUtils.StripAll(["abc", " abc"], null) = ["abc", "abc"]

StringUtils.StripAll(["abc ", null], null) = ["abc", null]

StringUtils.StripAll(["abc ", null], "yz") = ["abc ", null]

StringUtils.StripAll(["yabcz", null], "yz") = ["abc", null]

Parameters
strsinput strings
stripCharsChars to be stripped
Returns
result strings array
static string Ultimate.Utilities.StringUtils.StripEnd ( string  str,
string  stripChars = null 
)
static

Strips whitespace or the given set of chars at the ending of a String

See below examples

StringUtils.StripEnd(null, *) = null

StringUtils.StripEnd("", *) = ""

StringUtils.StripEnd("abc", "") = "abc"

StringUtils.StripEnd("abc", null) = "abc"

StringUtils.StripEnd(" abc", null) = " abc"

StringUtils.StripEnd("abc ", null) = "abc"

StringUtils.StripEnd(" abc ", null) = " abc"

StringUtils.StripEnd(" abcyx", "xyz") = " abc"

StringUtils.StripEnd("199.00", ".0") = "199"

Parameters
strinput string
stripCharsChars to be stripped
Returns
String
static string Ultimate.Utilities.StringUtils.StripStart ( string  str,
string  stripChars = null 
)
static

Strips whitespace or the given set of chars at the starting of a String

See below examples

StringUtils.StripStart(null, *) = null

StringUtils.StripStart("", *) = ""

StringUtils.StripStart("abc", "") = "abc"

StringUtils.StripStart("abc", null) = "abc"

StringUtils.StripStart(" abc", null) = "abc"

StringUtils.StripStart("abc ", null) = "abc "

StringUtils.StripStart(" abc ", null) = "abc "

StringUtils.StripStart("yxabc ", "xyz") = "abc "

Parameters
strinput string
stripCharsChars to be stripped
Returns
String
static string Ultimate.Utilities.StringUtils.StripToEmpty ( string  str)
static

Strips whitespace from the start and end of a String. Returns Empty ("") if the input is Null.

StringUtils.StripToEmpty(null) = ""

StringUtils.StripToEmpty("") = ""

StringUtils.StripToEmpty(" ") = ""

StringUtils.StripToEmpty("abc") = "abc"

StringUtils.StripToEmpty(" abc") = "abc"

StringUtils.StripToEmpty("abc ") = "abc"

StringUtils.StripToEmpty(" abc ") = "abc"

StringUtils.StripToEmpty(" ab c ") = "ab c"

Parameters
strinput string
Returns
string
static string Ultimate.Utilities.StringUtils.StripToNull ( string  str)
static

Strips whitespace from the start and end of a String and returns Null if the result is Empty ("").

StringUtils.StripToNull(null) = null

StringUtils.StripToNull("") = null

StringUtils.StripToNull(" ") = null

StringUtils.StripToNull("abc") = "abc"

StringUtils.StripToNull(" abc") = "abc"

StringUtils.StripToNull("abc ") = "abc"

StringUtils.StripToNull(" abc ") = "abc"

StringUtils.StripToNull(" ab c ") = "ab c"

Parameters
strinput string
Returns
string
static string Ultimate.Utilities.StringUtils.Substring ( string  str,
int  start 
)
static

Gets a substring from the given string without raising exceptions.

A negative start position can be used to start characters from the end of the String. Null string will return Null and Empty ("") string will return Empty ("") String.

StringUtils.Substring(null, *) = null

StringUtils.Substring("", *) = ""

StringUtils.Substring("abc", 0) = "abc"

StringUtils.Substring("abc", 2) = "c"

StringUtils.Substring("abc", 4) = ""

StringUtils.Substring("abc", -2) = "bc"

StringUtils.Substring("abc", -4) = "abc"

Parameters
strinput string
startstarting position, negative means count back from the end of the String by this many characters
Returns
string
static string Ultimate.Utilities.StringUtils.Substring ( string  str,
int  start,
int  end 
)
static

Gets a substring from the given string without raising exceptions.

StringUtils.Substring(null, *, *) = null

StringUtils.Substring("", * , *) = "";

StringUtils.Substring("abc", 0, 2) = "abc"

StringUtils.Substring("abc", 2, 0) = ""

StringUtils.Substring("abc", 2, 4) = "c"

StringUtils.Substring("abc", 4, 6) = ""

StringUtils.Substring("abc", 2, 2) = "c"

StringUtils.Substring("abc", -2, -1) = null

Parameters
strinput string
startstarting position,should be non negative
endending position,should be non negative
Returns
string
static string Ultimate.Utilities.StringUtils.SubstringAfter ( string  str,
string  separator 
)
static

Gets the substring after the first occurrence of a separator.

StringUtils.SubstringAfter(null, *) = null

StringUtils.SubstringAfter("", *) = ""

StringUtils.SubstringAfter(*, null) = ""

StringUtils.SubstringAfter("abc", "a") = "bc"

StringUtils.SubstringAfter("abcba", "b") = "cba"

StringUtils.SubstringAfter("abc", "c") = ""

StringUtils.SubstringAfter("abc", "d") = ""

StringUtils.SubstringAfter("abc", "") = "abc"

Parameters
strinput string
separatorseperator
Returns
the substring after the first occurrence of the separator
static string Ultimate.Utilities.StringUtils.SubstringAfterLast ( string  str,
string  separator 
)
static

Gets the substring after the last occurrence of a separator.

StringUtils.SubstringAfterLast(null, *) = null

StringUtils.SubstringAfterLast("", *) = ""

StringUtils.SubstringAfterLast(*, "") = ""

StringUtils.SubstringAfterLast(*, null) = ""

StringUtils.SubstringAfterLast("abc", "a") = "bc"

StringUtils.SubstringAfterLast("abcba", "b") = "a"

StringUtils.SubstringAfterLast("abc", "c") = ""

StringUtils.SubstringAfterLast("a", "a") = ""

StringUtils.SubstringAfterLast("a", "z") = ""

Parameters
strinput string
separatorseperator
Returns
the substring after the last occurrence of a separator.
static string Ultimate.Utilities.StringUtils.SubstringBefore ( string  str,
string  separator 
)
static

Gets the substring before the first occurrence of a separator.

StringUtils.SubstringBefore(null, *) = null

StringUtils.SubstringBefore("", *) = ""

StringUtils.SubstringBefore("abc", "a") = ""

StringUtils.SubstringBefore("abcba", "b") = "a"

StringUtils.SubstringBefore("abc", "c") = "ab"

StringUtils.SubstringBefore("abc", "d") = "abc"

StringUtils.SubstringBefore("abc", "") = ""

StringUtils.SubstringBefore("abc", null) = "abc"

Parameters
strinput string
separatorseperator
Returns
the substring before the first occurrence of the separator
static string Ultimate.Utilities.StringUtils.SubstringBeforeLast ( string  str,
string  separator 
)
static

Gets the substring before the last occurrence of a separator.

StringUtils.SubstringBeforeLast(null, *) = null

StringUtils.SubstringBeforeLast("", *) = ""

StringUtils.SubstringBeforeLast("abcba", "b") = "abc"

StringUtils.SubstringBeforeLast("abc", "c") = "ab"

StringUtils.SubstringBeforeLast("a", "a") = ""

StringUtils.SubstringBeforeLast("a", "z") = "a"

StringUtils.SubstringBeforeLast("a", null) = "a"

StringUtils.SubstringBeforeLast("a", "") = "a"

Parameters
strinput string
separatorseperator
Returns
the substring before the last occurrence of a separator.
static string Ultimate.Utilities.StringUtils.SubstringBetween ( string  str,
string  tag 
)
static

Gets the String that is nested in between two instances of the same String.

StringUtils.SubstringBetween(null, *) = null

StringUtils.SubstringBetween("", "") = ""

StringUtils.SubstringBetween("", "tag") = null

StringUtils.SubstringBetween("tagabctag", null) = null

StringUtils.SubstringBetween("tagabctag", "") = ""

StringUtils.SubstringBetween("tagabctag", "tag") = "abc"

Parameters
strthe String containing the substring
tagthe String before and after the substring
Returns
the substring or Null if no match found
static string Ultimate.Utilities.StringUtils.SubstringBetween ( string  str,
string  open,
string  close 
)
static

Gets the String that is nested in between two Strings.

Only the first match is returned.

StringUtils.SubstringBetween("wx[b]yz", "[", "]") = "b"

StringUtils.SubstringBetween(null, *, *) = null

StringUtils.SubstringBetween(*, null, *) = null

StringUtils.SubstringBetween(*, *, null) = null

StringUtils.SubstringBetween("", "", "") = ""

StringUtils.SubstringBetween("", "", "]") = null

StringUtils.SubstringBetween("", "[", "]") = null

StringUtils.SubstringBetween("yabcz", "", "") = ""

StringUtils.SubstringBetween("yabcz", "y", "z") = "abc"

StringUtils.SubstringBetween("yabczyabcz", "y", "z") = "abc"

Parameters
strinput String containing the substring
openthe String before the substring
closethe String after the substring
Returns
static string [] Ultimate.Utilities.StringUtils.SubstringsBetween ( string  str,
string  open,
string  close 
)
static

Searches a String for substrings delimited by a start and end tag, returning all matching substrings in an array.

StringUtils.SubstringsBetween("[a][b][c]", "[", "]") = ["a","b","c"]

StringUtils.SubstringsBetween(null, *, *) = null

StringUtils.SubstringsBetween(*, null, *) = null

StringUtils.SubstringsBetween(*, *, null) = null

StringUtils.SubstringsBetween("", "[", "]") = []

Parameters
strthe String containing the substrings
openthe String identifying the start of the substring
closethe String identifying the end of the substring
Returns
a String Array of substrings or Null if no match found
static string Ultimate.Utilities.StringUtils.SubstringWithNegatives ( string  str,
int  start,
int  end 
)
static

Gets a substring from the given string without raising exceptions.

StringUtils.Substring(null, *, *) = null

StringUtils.Substring("", * , *) = "";

StringUtils.Substring("abc", 0, 2) = "abc"

StringUtils.Substring("abc", 2, 0) = ""

StringUtils.Substring("abc", 2, 4) = "c"

StringUtils.Substring("abc", 4, 6) = ""

StringUtils.Substring("abc", 2, 2) = "c"

StringUtils.Substring("abc", -2, -1) = "bc"

StringUtils.Substring("abc", -4, 2) = "abc"

StringUtils.Substring("abcde", -2, 4)= "de"

StringUtils.Substring("abcde", -2, 2)= ""

Parameters
strinput string
startstarting position, negative means count back from the end of the String by this many characters
endending position, negative means count back from the end of the String by this many characters
Returns
string
static string Ultimate.Utilities.StringUtils.SwapCase ( string  str)
static

Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.

StringUtils.SwapCase(null) = null

StringUtils.SwapCase("") = ""

StringUtils.SwapCase("Good Day") = "gOOD dAY"

Parameters
strinput string
Returns
Swapcased string
static byte [] Ultimate.Utilities.StringUtils.ToAsciiBytes ( string  str,
bool  throwExceptions = false 
)
static

Converts the given string to byte array using the Ascii encoding.

StringUtils.ToAsciiBytes(null) = null

StringUtils.ToAsciiBytes("") = new byte[]{}

StringUtils.ToAsciiBytes("Apple") = new byte[] { 65, 112, 112, 108, 101 }

Parameters
strinput string
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted byte array or null if conversion fails
static string Ultimate.Utilities.StringUtils.ToAsciiString ( byte[]  bytes,
bool  throwExceptions = false 
)
static

Converts a byte array to a String using the Ascii encoding.

StringUtils.ToAsciiString(null) = null

StringUtils.ToAsciiString(new byte[]{}) = ""

StringUtils.ToAsciiString(new byte[] { 65, 112, 112, 108, 101 })= "Apple"

Parameters
bytesinput byte array
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted string or empty if convertion fails
static byte [] Ultimate.Utilities.StringUtils.ToBigEndianUnicodeBytes ( string  str,
bool  throwExceptions = false 
)
static

Converts the given string to byte array using the BigEndianUnicode encoding.

StringUtils.ToBigEndianUnicodeBytes(null) = null

StringUtils.ToBigEndianUnicodeBytes("") = new byte[]{}

StringUtils.ToBigEndianUnicodeBytes("Apple") = new byte[] { 0, 65, 0, 112, 0, 112, 0, 108, 0, 101 }

Parameters
strinput string
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted byte array or null if conversion fails
static string Ultimate.Utilities.StringUtils.ToBigEndianUnicodeString ( byte[]  bytes,
bool  throwExceptions = false 
)
static

Converts a byte array to a String using the BigEndianUnicode encoding.

StringUtils.ToBigEndianUnicodeString(null) = null

StringUtils.ToBigEndianUnicodeString(new byte[] { }) = ""

StringUtils.ToBigEndianUnicodeString(new byte[] { 0, 65, 0, 112, 0, 112, 0, 108, 0, 101 })= "Apple"

Parameters
bytesinput byte array
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted string or empty if convertion fails
static byte [] Ultimate.Utilities.StringUtils.ToDefaultBytes ( string  str,
bool  throwExceptions = false 
)
static

Converts the given string to byte array using the Default encoding.

StringUtils.ToDefaultBytes(null) = null

StringUtils.ToDefaultBytes("") = new byte[]{}

StringUtils.ToDefaultBytes("Apple") = new byte[] { 65, 112, 112, 108, 101 }

Parameters
strinput string
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted byte array or null if conversion fails
static string Ultimate.Utilities.StringUtils.ToDefaultString ( byte[]  bytes,
bool  throwExceptions = false 
)
static

Converts a byte array to a String using the Default encoding.

StringUtils.ToDefaultString(null) = null

StringUtils.ToDefaultString(new byte[] { }) = ""

StringUtils.ToDefaultString(new byte[] { 65, 112, 112, 108, 101 }) = "Apple"

Parameters
bytesinput byte array
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted string or empty if convertion fails
static byte [] Ultimate.Utilities.StringUtils.ToUnicodeBytes ( string  str,
bool  throwExceptions = false 
)
static

Converts the given string to byte array using the Unicode encoding.

StringUtils.ToUnicodeBytes(null) = null

StringUtils.ToUnicodeBytes("") = new byte[]{}

StringUtils.ToUnicodeBytes("Apple") = new byte[] { 65, 0, 112, 0, 112, 0, 108, 0, 101, 0 }

Parameters
strinput string
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted byte array or null if conversion fails
static string Ultimate.Utilities.StringUtils.ToUnicodeString ( byte[]  bytes,
bool  throwExceptions = false 
)
static

Converts a byte array to a String using the Unicode encoding.

StringUtils.ToUnicodeString(null) = null

StringUtils.ToUnicodeString(new byte[] { }) = ""

StringUtils.ToUnicodeString(new byte[] { 65, 0, 112, 0, 112, 0, 108, 0, 101, 0 }) = "Apple"

Parameters
bytesinput byte array
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted string or empty if convertion fails
static byte [] Ultimate.Utilities.StringUtils.ToUtf32Bytes ( string  str,
bool  throwExceptions = false 
)
static

Converts the given string to byte array using the UTF32 encoding.

StringUtils.ToUtf32Bytes(null) = null

StringUtils.ToUtf32Bytes("") = new byte[]{}

StringUtils.ToUtf32Bytes("Apple") = new byte[] { 65, 0, 0, 0, 112, 0, 0, 0, 112, 0, 0, 0, 108, 0, 0, 0, 101, 0, 0, 0 }

Parameters
strinput string
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted byte array or null if conversion fails
static string Ultimate.Utilities.StringUtils.ToUtf32String ( byte[]  bytes,
bool  throwExceptions = false 
)
static

Converts a byte array to a String using the UTF32 encoding.

StringUtils.ToUtf32String(null) = null

StringUtils.ToUtf32String(new byte[] { }) = ""

StringUtils.ToUtf32String(new byte[] { 65, 0, 0, 0, 112, 0, 0, 0, 112, 0, 0, 0, 108, 0, 0, 0, 101, 0, 0, 0 }) = "Apple"

Parameters
bytesinput byte array
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted string or empty if convertion fails
static byte [] Ultimate.Utilities.StringUtils.ToUtf7Bytes ( string  str,
bool  throwExceptions = false 
)
static

Converts the given string to byte array using the UTF7 encoding.

StringUtils.ToUtf7Bytes(null) = null

StringUtils.ToUtf7Bytes("") = new byte[]{}

StringUtils.ToUtf7Bytes("Apple") = new byte[] { 65, 112, 112, 108, 101 }

Parameters
strinput string
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted byte array or null if conversion fails
static string Ultimate.Utilities.StringUtils.ToUtf7String ( byte[]  bytes,
bool  throwExceptions = false 
)
static

Converts a byte array to a String using the UTF7 encoding.

StringUtils.ToUtf7String(null) = null

StringUtils.ToUtf7String(new byte[] { }) = ""

StringUtils.ToUtf7String(new byte[] { 65, 112, 112, 108, 101 }) = "Apple"

Parameters
bytesinput byte array
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted string or empty if convertion fails
static byte [] Ultimate.Utilities.StringUtils.ToUtf8Bytes ( string  str,
bool  throwExceptions = false 
)
static

Converts the given string to byte array using the UTF8 encoding.

StringUtils.ToUtf8Bytes(null) = null

StringUtils.ToUtf8Bytes("") = new byte[]{}

StringUtils.ToUtf8Bytes("Apple") = new byte[] { 65, 112, 112, 108, 101 }

Parameters
strinput string
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted byte array or null if conversion fails
static string Ultimate.Utilities.StringUtils.ToUtf8String ( byte[]  bytes,
bool  throwExceptions = false 
)
static

Converts a byte array to a String using the UTF8 encoding.

StringUtils.ToUtf8String(null) = null

StringUtils.ToUtf8String(new byte[] { }) = ""

StringUtils.ToUtf8String(new byte[] { 65, 112, 112, 108, 101 }) = "Apple"

Parameters
bytesinput byte array
throwExceptionsdo u want to throw exception? (default false). Pass 'true' to allow exceptions
Returns
Converted string or empty if convertion fails
static string Ultimate.Utilities.StringUtils.Trim ( string  str)
static

Removes control characters from both ends of the String. Handles null by returning null.

See below examples

StringUtils.Trim(null) = null

StringUtils.Trim("") = ""

StringUtils.Trim(" ") = ""

StringUtils.Trim("abc") = "abc"

StringUtils.Trim(" abc ") = "abc"

Parameters
strinput string
Returns
Trimmed string
static string Ultimate.Utilities.StringUtils.TrimToEmpty ( string  str)
static

Removes control characters from both ends of the String by returning Empty String ("") if the String is Empty ("") after the trim or null

See below examples

StringUtils.TrimToEmpty(null) = ""

StringUtils.TrimToEmpty("") = ""

StringUtils.TrimToEmpty(" ") = ""

StringUtils.TrimToEmpty("abc") = "abc"

StringUtils.TrimToEmpty(" abc ") = "abc"

Parameters
strinput string
Returns
Trimmed string
static string Ultimate.Utilities.StringUtils.TrimToNull ( string  str)
static

Removes control characters from both ends of the String by returning null if the String is Empty ("") after the trim or null

See below examples

StringUtils.TrimToNull(null) = null

StringUtils.TrimToNull("") = null

StringUtils.TrimToNull(" ") = null

StringUtils.TrimToNull("abc") = "abc"

StringUtils.TrimToNull(" abc ") = "abc"

Parameters
strinput string
Returns
Trimmed string
static string Ultimate.Utilities.StringUtils.UnCapitalize ( string  str)
static

Uncapitalizes a String, changing the first letter to lower case

StringUtils.UnCapitalize(null) = null

StringUtils.UnCapitalize("") = ""

StringUtils.UnCapitalize("cat") = "cat"

StringUtils.UnCapitalize("Cat") = "cat"

StringUtils.UnCapitalize("CAT") = "cAT"

Parameters
strinput string
Returns
Uncapitalized string
static string Ultimate.Utilities.StringUtils.UpperCase ( string  str)
static

Converts a string to upper case

StringUtils.UpperCase(null) = null

StringUtils.UpperCase("") = ""

StringUtils.UpperCase("abc") = "ABC"

Parameters
strinput string
Returns
uppercased string
static string Ultimate.Utilities.StringUtils.Wrap ( string  str,
char  wrapWith 
)
static

Wraps a string with a character.

StringUtils.Wrap(null, *) = null

StringUtils.Wrap("", *) = ""

StringUtils.Wrap("ab", '\0') = "ab"

StringUtils.Wrap("ab", 'x') = "xabx"

StringUtils.Wrap("ab", '\'') = "'ab'"

StringUtils.Wrap("\"ab"", '\"') = "\""ab"""

Parameters
strinput
wrapWithcharacter to be wrapped with
Returns
wrapped text
static string Ultimate.Utilities.StringUtils.Wrap ( string  str,
string  wrapWith 
)
static

raps a String with the given String.

StringUtils.Wrap(null, *) = null

StringUtils.Wrap("", *) = ""

StringUtils.Wrap("ab", null) = "ab"

StringUtils.Wrap("ab", "x") = "xabx"

StringUtils.Wrap("ab", "\"") = ""ab"" <para/> StringUtils.Wrap(""ab"", """) = """ab""" <para/> StringUtils.Wrap("ab", "'") = "'ab'" <para/> StringUtils.Wrap("'abcd'", "'") = "''abcd''" <para/> StringUtils.Wrap(""abcd"", "'") = "'"abcd"'" <para/> StringUtils.Wrap("'abcd'", """) = ""'abcd'""

Parameters
strinput string
wrapWithstring to be wrapped with
Returns
wrapped text

Member Data Documentation

readonly char Ultimate.Utilities.StringUtils.Cr = '\r'
static

Carriage Return Character ''

readonly string Ultimate.Utilities.StringUtils.Empty = ""
static

Empty string ""

readonly int Ultimate.Utilities.StringUtils.IndexNotFound = -1
static

Index Not Found (-1)

readonly char Ultimate.Utilities.StringUtils.Lf = '\n'
static

Line Feed Character '
'

readonly string Ultimate.Utilities.StringUtils.Space = " "
static

Space Character " "


The documentation for this class was generated from the following file: