![]() |
Ultimate.Utilities.Docs
|
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... | |
Utility methods for String operations. All methods in the StringUtils are Null safe.
|
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
str | input string |
maxWidth | maximum length of result String, must be at least 4 |
|
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
str | input string |
offset | offset length to be used on the left edge of string |
maxWidth | maximum length of result String, must be at least 4 (should be atleast 7 if offset is used). |
|
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"
str | input string |
middle | the String to replace the middle characters with |
length | length to abbreviate |
|
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"
str | input string |
suffix | suffix to add at the end of the string |
ignoreCase | is case ignored? (default false) |
suffixes | array of suffixes. Once a suffix is found others will be terminated (default 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"
str | input string |
suffix | suffix to add at the end of the string |
suffixes | array of suffixes. Once a suffix is found others will be terminated (default null) |
|
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"
str | input string |
|
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 "
str | input string |
size | size of new String, negative treated as zero |
|
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"
str | input string |
size | size of new String, negative treated as zero |
padChar | character to pad with |
|
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 "
str | input string |
size | size of new String, negative treated as zero |
padStr | string to pad with |
|
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") = ""
str | input string |
|
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") = ""
str | input string |
|
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
str | input string |
searchValue | search string |
|
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
str | input string |
searchValue | search char |
|
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
str | input string |
searchChars | search characters |
|
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
str | input string |
searchChars | search characters |
|
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
str | input string |
searchStrings | search strings |
|
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
str | input string |
searchValue | search string |
|
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
str | input string |
searchValue | search char |
|
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
str | input string |
searchChars | search characters |
|
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
str | input string |
searchChars | search characters |
|
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
str | input string |
searchChars | search characters |
|
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
str | input string |
searchChars | search characters |
|
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
str | input string |
|
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
str | input string |
sub | substring to search for |
|
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
str | input string |
ch | character to search for |
|
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
str | input string |
defaultStr | default string to be returned incase of blank ("" will be returned by default if not passed) |
|
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
str | input string |
defaultStr | default string to be returned incase of empty |
|
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"
str | input string |
defaultStr | default string to be returned incase of null ("" will be returned by default if not passed) |
|
static |
Deletes all whitespaces from a String
StringUtils.DeleteWhitespace(null) = null
StringUtils.DeleteWhitespace("") = ""
StringUtils.DeleteWhitespace("abc") = "abc"
StringUtils.DeleteWhitespace(" ab c ") = "abc"
str | input string |
|
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"
str1 | the first string |
str2 | the second string |
|
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
str | input string |
suffix | the suffix to find |
ignoreCase | is case ignored? (default false) |
|
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
str | input string |
ignoreCase | is case ignored? (default false) |
searchStrings | array of suffix search strings |
|
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
str | input string |
suffix | the suffix to find |
|
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
s1 | string1 |
s2 | string2 |
|
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
s1 | string1 |
s2 | string2 |
|
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 "
strs | inpu array of strings |
|
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
s1 | string |
searchValue | search char |
startPos | starting position |
|
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
s1 | string |
searchValue | search string |
startPos | starting position |
|
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
str | input string |
searchChars | search characters |
|
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
str | input string |
searchChars | search characters |
|
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
str | input string |
searchStrs | search strings array |
|
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
str | input string |
searchChars | not in search characters |
|
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
str | input string |
searchChars | not in search characters |
|
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
str1 | the first string |
str2 | the second string |
|
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
strArray | input array of strings |
|
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
s1 | string |
searchValue | search string |
startPos | starting position |
|
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
s1 | string |
searchValue | search char |
startPos | starting position |
|
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
str | input string |
|
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
str | input string |
|
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
str | input string |
|
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
str | input string |
|
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
str | input string |
|
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
str | input string |
|
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
strArgs | input strings array |
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
strArgs | input strings array |
|
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
strArgs | input strings array |
|
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
str | input string |
|
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
str | input string |
|
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
str | input string |
|
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
strArgs | input strings array |
|
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
str | input string |
|
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
str | input string |
|
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
str | input string |
|
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
str | input string |
|
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
str | input string |
|
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"
elements | input array of elements |
|
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"
array | input array of elements |
separator | seperator character |
|
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"
array | input array of elements |
separator | seperator character(default 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"
array | input array of elements |
separator | seperator character(default 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"
array | input array of elements |
separator | seperator character(default 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"
array | input array of elements |
separator | seperator character(default 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"
array | input array of elements |
separator | seperator character(default 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"
array | input array of elements |
separator | seperator character(default 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"
array | input array of elements |
separator | seperator character(default 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, 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"
array | input array of elements |
separator | seperator character |
startIndex | the first index to start joining from. |
noOfItems | no.of items to join |
|
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"
array | input array of elements |
separator | seperator character |
startIndex | the first index to start joining from. |
noOfItems | no.of items to join |
|
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"
array | input array of elements |
separator | seperator character |
startIndex | the first index to start joining from. |
noOfItems | no.of items to join |
|
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"
array | input array of elements |
separator | seperator character |
startIndex | the first index to start joining from. |
noOfItems | no.of items to join |
|
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"
array | input array of elements |
separator | seperator character |
startIndex | the first index to start joining from. |
noOfItems | no.of items to join |
|
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"
array | input array of elements |
separator | seperator character |
startIndex | the first index to start joining from. |
noOfItems | no.of items to join |
|
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"
array | input array of elements |
separator | seperator character |
startIndex | the first index to start joining from. |
noOfItems | no.of items to join |
|
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"
array | input array of elements |
separator | seperator character |
startIndex | the first index to start joining from. |
noOfItems | no.of items to join |
|
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"
objects | the args having the values to join together. |
|
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"
separator | separator character |
objects | the args having the values to join together. |
|
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
s1 | string |
searchValue | search string |
startPos | starting position |
|
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
s1 | string |
searchValue | search char |
startPos | starting position |
|
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
str | input string |
searchStrs | search strings array |
|
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
s1 | string |
searchValue | search string |
startPos | starting position |
|
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
s1 | string |
searchValue | search char |
startPos | starting position |
|
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
str | string |
searchValue | search string |
ordinal | n-th last index |
|
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
str | string |
searchValue | search char |
ordinal | n-th last index |
|
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"
str | input string |
len | length |
|
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"
str | input string |
size | the size to pad to |
|
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"
str | input string |
size | the size to pad to |
padChar | the character to pad with |
|
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"
str | input string |
size | the size to pad to |
padStr | the string to pad with |
|
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
str | input string |
|
static |
Converts a string to lower case
StringUtils.LowerCase(null) = null
StringUtils.LowerCase("") = ""
StringUtils.LowerCase("AbC") = "abc"
str | input string |
|
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"
str | input string |
pos | starting position |
len | legth of the mid string |
|
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"
str | input string |
|
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
str | string |
searchValue | search string |
ordinal | n-th index |
|
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
str | string |
searchValue | search char |
ordinal | n-th index |
|
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"
str | input string |
overlay | string to overlay |
start | the position to start overlaying at |
end | the position to stop overlaying before |
|
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"
str | input string |
prefix | prefix to add at the start of the string |
ignoreCase | is case ignored? (default false) |
prefixes | array of prefixes. Once a prefix is found others will be terminated (default 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"
str | input string |
prefix | prefix to add at the start of the string |
prefixes | array of prefixes. Once a prefix is found others will be terminated (default null) |
|
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"
str | input string |
remove | substring to 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"
str | input string |
remove | substring to 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"
str | input string |
remove | substring to 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"
str | input string |
remove | substring to remove |
|
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"
source | input string |
regex | regular expression to match |
|
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"
str | input string |
remove | substring to 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"
str | input string |
remove | substring to remove |
|
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) = ""
str | string to repeat |
repeat | no.of times to 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) = "?, ?, ?"
str | string to repeat |
separator | separator to be added |
repeat | no.of times to 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) = ""
ch | character to repeat |
repeat | no.of times to repeat |
|
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"
text | input text |
searchString | string to find |
replacement | string to replace |
|
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"
text | input text |
searchString | string to find |
replacement | string to replace |
max | maximum number of values to replace |
|
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"
str | input string |
searchChar | char to search for |
replaceChar | char to replace with |
|
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"
str | input string |
searchChars | chars to search for |
replaceChars | chars to replace with |
|
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"
text | text to search and replace in, no operation if null |
searchList | the Strings to search for, no operation if null |
replacementList | the Strings to replace them with, no operation if null |
|
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"
text | text to search and replace in, no operation if null |
searchList | the Strings to search for, no operation if null |
replacementList | the Strings to replace them with, no operation if null |
|
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"
text | input string |
searchString | string to find |
replacement | string to replace |
|
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"
source | input string |
regex | regular expression to match |
replacement | string to replace |
ignoreCase | true if the ignore case (default false) |
|
static |
Reverses a string
StringUtils.Reverse(null) = null
StringUtils.Reverse("") = ""
StringUtils.Reverse("bat") = "tab"
str | input string |
|
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"
str | input string |
separatorChar | the seperator character to use |
|
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"
str | input string |
len | length |
|
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"
str | the String to pad out |
size | the size to pad to |
|
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"
str | input string |
size | the size to pad to |
padChar | the character to pad with |
|
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 "
str | input string |
size | the size to pad to |
padStr | the string to pad with |
|
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"
str | input string |
shift | number of times to shift |
|
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"]
str | input string |
|
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"]
str | input string |
separatorChar | the character used as the delimiter |
|
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"]
str | input string |
separatorChars | the characters used as the delimiter |
|
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"]
str | input string |
separatorChars | the characters used as the delimiter |
max | max number of elements to include in the array.A zero or negative value implies no limit |
|
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"]
str | input string |
|
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"]
str | input string |
|
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"]
str | input string |
separator | seperator string |
|
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"]
str | input string |
separator | seperator string |
max | max number of elements to include in the array.A zero or negative value implies no limit |
|
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"]
str | input string |
separator | seperator string |
|
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"]
str | input string |
separator | seperator string |
max | max number of elements to include in the array.A zero or negative value implies no limit |
k
|
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", ""]
str | input string |
|
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", ""]
str | input string |
separatorChar | the character used as the delimiter |
|
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", ""]
str | input string |
separatorChars | the characters used as the delimiters |
|
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"]
str | input string |
separatorChars | the characters used as the delimiters |
max | max number of elements to include in the array.A zero or negative value implies no limit |
k
|
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
str | input string |
prefix | the prefix to find |
ignoreCase | is case ignored? (default false) |
|
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
str | input string |
ignoreCase | is case ignored? |
searchStrings | array of prefix search strings |
|
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
str | input string |
prefix | the prefix to find |
|
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"
str | input string |
stripChars | Chars to be stripped |
|
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"
input | input string |
|
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"]
strs | input strings |
|
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]
strs | input strings |
stripChars | Chars to be stripped |
|
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"
str | input string |
stripChars | Chars to be stripped |
|
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 "
str | input string |
stripChars | Chars to be stripped |
|
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"
str | input string |
|
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"
str | input string |
|
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"
str | input string |
start | starting position, negative means count back from the end of the String by this many characters |
|
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
str | input string |
start | starting position,should be non negative |
end | ending position,should be non negative |
|
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"
str | input string |
separator | seperator |
|
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") = ""
str | input string |
separator | seperator |
|
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"
str | input string |
separator | seperator |
|
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"
str | input string |
separator | seperator |
|
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"
str | the String containing the substring |
tag | the String before and after the substring |
|
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"
str | input String containing the substring |
open | the String before the substring |
close | the String after the substring |
|
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("", "[", "]") = []
str | the String containing the substrings |
open | the String identifying the start of the substring |
close | the String identifying the end of the substring |
|
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)= ""
str | input string |
start | starting position, negative means count back from the end of the String by this many characters |
end | ending position, negative means count back from the end of the String by this many characters |
|
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"
str | input string |
|
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 }
str | input string |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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"
bytes | input byte array |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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 }
str | input string |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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"
bytes | input byte array |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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 }
str | input string |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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"
bytes | input byte array |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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 }
str | input string |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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"
bytes | input byte array |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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 }
str | input string |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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"
bytes | input byte array |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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 }
str | input string |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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"
bytes | input byte array |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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 }
str | input string |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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"
bytes | input byte array |
throwExceptions | do u want to throw exception? (default false). Pass 'true' to allow exceptions |
|
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"
str | input string |
|
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"
str | input string |
|
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"
str | input string |
|
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"
str | input string |
|
static |
Converts a string to upper case
StringUtils.UpperCase(null) = null
StringUtils.UpperCase("") = ""
StringUtils.UpperCase("abc") = "ABC"
str | input string |
|
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"""
str | input |
wrapWith | character to be wrapped with |
|
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'""
str | input string |
wrapWith | string to be wrapped with |
|
static |
Carriage Return Character ''
|
static |
Empty string ""
|
static |
Index Not Found (-1)
|
static |
Line Feed Character '
'
|
static |
Space Character " "