Operations on String that are null safe.
 
- IsEmpty/IsBlank - checks if a String contains text
- Trim/Strip - removes leading and trailing whitespace
- Equals - compares two strings null-safe
- startsWith - check if a String starts with a prefix null-safe
- endsWith - check if a String ends with a suffix null-safe
- IndexOf/LastIndexOf/Contains - null-safe index-of checks
- IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut - index-of any of a set of Strings
- ContainsOnly/ContainsNone/ContainsAny - does String contains only/none/any of these characters
- Substring/Left/Right/Mid - null-safe substring extractions
- SubstringBefore/SubstringAfter/SubstringBetween - substring extraction relative to other strings
- Split/Join - splits a String into an array of substrings and vice versa
- Remove/Delete - removes part of a String
- Replace/Overlay - Searches a String and replaces one String with another
- Chomp/Chop - removes the last part of a String
- LeftPad/RightPad/Center/Repeat - pads a String
- UpperCase/LowerCase/SwapCase/Capitalize/Uncapitalize - changes the case of a String
- CountMatches - counts the number of occurrences of one String in another
- IsAlpha/IsNumeric/IsWhitespace/IsAsciiPrintable - checks the characters in a String
- DefaultString - protects against a null input String
- Reverse/ReverseDelimited - reverses a String
- Abbreviate - abbreviates a string using ellipsis
- Difference - compares Strings and reports on their differences
- LevensteinDistance - the number of changes needed to change one String into another
 The StringUtils class defines certain words related to String
 handling.
 
- null - null
- empty - a zero-length string ("")
- space - the space character (' ', char 32)
- whitespace - the characters defined by
 Character.isWhitespace(char)
- trim - the characters <= 32 as in String.trim()
 StringUtils handles null input Strings quietly.
 That is to say that a null input will return null.
 Where a boolean or int is being returned details
 vary by method.
 
 A side effect of the null handling is that a
 NullPointerException should be considered a bug in
 StringUtils (except for deprecated methods).
 
 Methods in this class give sample code to explain their operation. The symbol
 * is used to indicate any input including null.
 
- Since:
- 1.0
- Version:
- $Id: StringUtils.java 911986 2010-02-19 21:19:05Z niallp $
- Author:
- Apache Software Foundation, Apache Jakarta Turbine, Jon S. Stevens, Daniel L. Rall, Greg Coladonato, Ed Korthof, Rand McNeely, Fredrik Westermarck, Holger Krauth, Alexander Day Chaffee, Henning P. Schmiedehausen, Arun Mammen Thomas, Gary Gregory, Phil Steitz, Al Chou, Michael Davey, Reuben Sivan, Chris Hyzer, Scott Johnson
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe empty String"".static final intRepresents a failed index search.
- 
Method SummaryModifier and TypeMethodDescriptionstatic Stringabbreviate(String str, int maxWidth) Abbreviates a String using ellipses.static Stringabbreviate(String str, int offset, int maxWidth) Abbreviates a String using ellipses.static booleancontainsAny(String str, char... searchChars) Checks if the String contains any character in the given set of characters.static intcountMatches(String str, String sub) Counts how many times the substring appears in the larger String.static StringdefaultIfBlank(String str, String defaultStr) Returns either the passed in CharSequence, or if the CharSequence is whitespace, empty ("") ornull, the value ofdefaultStr.static StringdefaultIfEmpty(String str, String defaultStr) Returns either the passed in String, or if the String is empty ornull, the value ofdefaultStr.static <T> TdefaultIfNull(T object, T defaultValue) Returns a default value if the object passed isnull.static StringdefaultString(String str) Returns either the passed in String, or if the String isnull, an empty String ("").static StringdefaultString(String str, String defaultStr) Returns either the passed in String, or if the String isnull, the value ofdefaultStr.static booleanCompares two objects for deep equality, where either one or both objects may benull.static booleanCompares two strings for equality, where either one or both objects may benull.static <T> TfirstNonNull(T... objects) Returns the first non-nullargument.static booleanChecks if a String is whitespace, empty ("") or null.static booleanChecks if a String is empty ("") or null.static StringJoins the elements of the provided array into a single String containing the provided list of elements.static StringJoins the elements of the provided array into a single String containing the provided list of elements.static StringJoins the elements of the provided array into a single String containing the provided list of elements.static StringJoins the elements of the provided array into a single String containing the provided list of elements.static <T> Stringjoin(T... elements) Joins the elements of the provided array into a single String containing the provided list of elements.static StringLeft pad a String with spaces (' ').static StringLeft pad a String with a specified character.static Stringstatic Stringstatic Stringstatic StringLeft pad a String with a specified String.static StringReplaces all occurrences of a String within another String.static StringReplaces a String with another String inside a larger String, for the firstmaxvalues of the search String.static StringreplaceEach(String text, String[] searchList, String[] replacementList) Replaces all occurrences of Strings within another String.static StringRight pad a String with spaces (' ').static StringRight pad a String with a specified character.static Stringstatic Stringstatic Stringstatic StringRight pad a String with a specified String.static String[]split(String regex, CharSequence input) A custom adaptation ofPattern.split(CharSequence, int).static StringtoCamelCase(String string) Convert a string to camel casestatic StringtoCamelCaseLC(String string) Convert a string to camel case starting with a lower case letterstatic StringChange a string's first letter to lower casestatic StringChange a string's first letter to lower casestatic StringChange a string's first letter to upper casestatic StringChange a string's first letter to upper case
- 
Field Details- 
EMPTYThe empty String"".- Since:
- 2.0
- See Also:
 
- 
INDEX_NOT_FOUNDpublic static final int INDEX_NOT_FOUNDRepresents a failed index search.- Since:
- 2.1
- See Also:
 
 
- 
- 
Method Details- 
defaultStringReturns either the passed in String, or if the String is null, an empty String ("").StringUtils.defaultString(null) = "" StringUtils.defaultString("") = "" StringUtils.defaultString("bat") = "bat"- Parameters:
- str- the String to check, may be null
- Returns:
- the passed in String, or the empty String if it was
         null
- See Also:
 
- 
defaultStringReturns either the passed in String, or if the String is null, the value ofdefaultStr.StringUtils.defaultString(null, "NULL") = "NULL" StringUtils.defaultString("", "NULL") = "" StringUtils.defaultString("bat", "NULL") = "bat"- Parameters:
- str- the String to check, may be null
- defaultStr- the default String to return if the input is- null, may be null
- Returns:
- the passed in String, or the default if it was null
- See Also:
 
- 
defaultIfEmptyReturns either the passed in String, or if the String is empty or null, the value ofdefaultStr.StringUtils.defaultIfEmpty(null, "NULL") = "NULL" StringUtils.defaultIfEmpty("", "NULL") = "NULL" StringUtils.defaultIfEmpty("bat", "NULL") = "bat"- Parameters:
- str- the String to check, may be null
- defaultStr- the default String to return if the input is empty ("") or- null, may be null
- Returns:
- the passed in String, or the default
- See Also:
 
- 
defaultIfBlankReturns either the passed in CharSequence, or if the CharSequence is whitespace, empty ("") or null, the value ofdefaultStr.StringUtils.defaultIfBlank(null, "NULL") = "NULL" StringUtils.defaultIfBlank("", "NULL") = "NULL" StringUtils.defaultIfBlank(" ", "NULL") = "NULL" StringUtils.defaultIfBlank("bat", "NULL") = "bat" StringUtils.defaultIfBlank("", null) = null- Parameters:
- str- the CharSequence to check, may be null
- defaultStr- the default CharSequence to return if the input is whitespace, empty ("") or- null, may be null
- Returns:
- the passed in CharSequence, or the default
- See Also:
 
- 
isEmptyChecks if a String is empty ("") or null. StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = falseNOTE: This method changed in Lang version 2.0. It no longer trims the String. That functionality is available in isBlank(). - Parameters:
- str- the String to check, may be null
- Returns:
- trueif the String is empty or null
 
- 
isBlankChecks if a String is whitespace, empty ("") or null. StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false- Parameters:
- str- the String to check, may be null
- Returns:
- trueif the String is null, empty or whitespace
- Since:
- 2.0
 
- 
countMatchesCounts how many times the substring appears in the larger String. A nullor empty ("") String input returns0.StringUtils.countMatches(null, *) = 0 StringUtils.countMatches("", *) = 0 StringUtils.countMatches("abba", null) = 0 StringUtils.countMatches("abba", "") = 0 StringUtils.countMatches("abba", "a") = 2 StringUtils.countMatches("abba", "ab") = 1 StringUtils.countMatches("abba", "xxx") = 0- Parameters:
- str- the String to check, may be null
- sub- the substring to count, may be null
- Returns:
- the number of occurrences, 0 if either String is
         null
 
- 
rightPadRight pad a String with spaces (' '). The String is padded to the size of size.StringUtils.rightPad(null, *) = null StringUtils.rightPad("", 3) = " " StringUtils.rightPad("bat", 3) = "bat" StringUtils.rightPad("bat", 5) = "bat " StringUtils.rightPad("bat", 1) = "bat" StringUtils.rightPad("bat", -1) = "bat"- Parameters:
- str- the String to pad out, may be null
- size- the size to pad to
- Returns:
- right padded String or original String if no padding is necessary,
  nullif null String input
 
- 
rightPad
- 
rightPadRight pad a String with a specified character. The String is padded to the size of size.StringUtils.rightPad(null, *, *) = null StringUtils.rightPad("", 3, 'z') = "zzz" StringUtils.rightPad("bat", 3, 'z') = "bat" StringUtils.rightPad("bat", 5, 'z') = "batzz" StringUtils.rightPad("bat", 1, 'z') = "bat" StringUtils.rightPad("bat", -1, 'z') = "bat"- Parameters:
- str- the String to pad out, may be null
- size- the size to pad to
- padChar- the character to pad with
- Returns:
- right padded String or original String if no padding is necessary,
  nullif null String input
- Since:
- 2.0
 
- 
rightPad
- 
rightPadRight pad a String with a specified String. The String is padded to the size of size.StringUtils.rightPad(null, *, *) = null StringUtils.rightPad("", 3, "z") = "zzz" StringUtils.rightPad("bat", 3, "yz") = "bat" StringUtils.rightPad("bat", 5, "yz") = "batyz" StringUtils.rightPad("bat", 8, "yz") = "batyzyzy" StringUtils.rightPad("bat", 1, "yz") = "bat" StringUtils.rightPad("bat", -1, "yz") = "bat" StringUtils.rightPad("bat", 5, null) = "bat " StringUtils.rightPad("bat", 5, "") = "bat "- Parameters:
- str- the String to pad out, may be null
- size- the size to pad to
- padStr- the String to pad with, null or empty treated as single space
- Returns:
- right padded String or original String if no padding is necessary,
  nullif null String input
 
- 
rightPad
- 
leftPadLeft pad a String with spaces (' '). The String is padded to the size of size.StringUtils.leftPad(null, *) = null StringUtils.leftPad("", 3) = " " StringUtils.leftPad("bat", 3) = "bat" StringUtils.leftPad("bat", 5) = " bat" StringUtils.leftPad("bat", 1) = "bat" StringUtils.leftPad("bat", -1) = "bat"- Parameters:
- str- the String to pad out, may be null
- size- the size to pad to
- Returns:
- left padded String or original String if no padding is necessary,
  nullif null String input
 
- 
leftPad
- 
leftPadLeft pad a String with a specified character. Pad to a size of size.StringUtils.leftPad(null, *, *) = null StringUtils.leftPad("", 3, 'z') = "zzz" StringUtils.leftPad("bat", 3, 'z') = "bat" StringUtils.leftPad("bat", 5, 'z') = "zzbat" StringUtils.leftPad("bat", 1, 'z') = "bat" StringUtils.leftPad("bat", -1, 'z') = "bat"- Parameters:
- str- the String to pad out, may be null
- size- the size to pad to
- padChar- the character to pad with
- Returns:
- left padded String or original String if no padding is necessary,
  nullif null String input
- Since:
- 2.0
 
- 
leftPad
- 
leftPadLeft pad a String with a specified String. Pad to a size of size.StringUtils.leftPad(null, *, *) = null StringUtils.leftPad("", 3, "z") = "zzz" StringUtils.leftPad("bat", 3, "yz") = "bat" StringUtils.leftPad("bat", 5, "yz") = "yzbat" StringUtils.leftPad("bat", 8, "yz") = "yzyzybat" StringUtils.leftPad("bat", 1, "yz") = "bat" StringUtils.leftPad("bat", -1, "yz") = "bat" StringUtils.leftPad("bat", 5, null) = " bat" StringUtils.leftPad("bat", 5, "") = " bat"- Parameters:
- str- the String to pad out, may be null
- size- the size to pad to
- padStr- the String to pad with, null or empty treated as single space
- Returns:
- left padded String or original String if no padding is necessary,
  nullif null String input
 
- 
leftPad
- 
abbreviateAbbreviates a String using ellipses. This will turn "Now is the time for all good men" into "Now is the time for..." Specifically: - If stris less thanmaxWidthcharacters long, return it.
- Else abbreviate it to (substring(str, 0, max-3) + "…").
- If maxWidthis less than4, throw anIllegalArgumentException.
- In no case will it return a String of length greater than
       maxWidth.
 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) = IllegalArgumentException- Parameters:
- str- the String to check, may be null
- maxWidth- maximum length of result String, must be at least 4
- Returns:
- abbreviated String, nullif null String input
- Throws:
- IllegalArgumentException- if the width is too small
- Since:
- 2.0
 
- If 
- 
abbreviateAbbreviates a String using ellipses. This will turn "Now is the time for all good men" into "...is the time for..." Works like abbreviate(String, int), but allows you to specify a "left edge" offset. Note that this left edge is not necessarily going to be the leftmost character in the result, or the first character following the ellipses, but it will appear somewhere in the result.In no case will it return a String of length greater than maxWidth.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) = IllegalArgumentException StringUtils.abbreviate("abcdefghij", 5, 6) = IllegalArgumentException- Parameters:
- str- the String to check, may be null
- offset- left edge of source String
- maxWidth- maximum length of result String, must be at least 4
- Returns:
- abbreviated String, nullif null String input
- Throws:
- IllegalArgumentException- if the width is too small
- Since:
- 2.0
 
- 
containsAnyChecks if the String contains any character in the given set of characters. A nullString will returnfalse. Anullor zero length search array will returnfalse.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("aba", ['z']) = false- Parameters:
- str- the String to check, may be null
- searchChars- the chars to search for, may be null
- Returns:
- the trueif any of the chars are found,falseif no match or null input
- Since:
- 2.4
 
- 
replaceReplaces all occurrences of a String within another String. A nullreference passed to this method is a no-op.StringUtils.replace(null, *, *) = null StringUtils.replace("", *, *) = "" StringUtils.replace("any", null, *) = "any" StringUtils.replace("any", *, null) = "any" StringUtils.replace("any", "", *) = "any" StringUtils.replace("aba", "a", null) = "aba" StringUtils.replace("aba", "a", "") = "b" StringUtils.replace("aba", "a", "z") = "zbz"- Parameters:
- text- text to search and replace in, may be null
- searchString- the String to search for, may be null
- replacement- the String to replace it with, may be null
- Returns:
- the text with any replacements processed,
  nullif null String input
- See Also:
 
- 
replaceReplaces a String with another String inside a larger String, for the first maxvalues of the search String.A nullreference passed to this method is a no-op.StringUtils.replace(null, *, *, *) = null StringUtils.replace("", *, *, *) = "" StringUtils.replace("any", null, *, *) = "any" StringUtils.replace("any", *, null, *) = "any" StringUtils.replace("any", "", *, *) = "any" StringUtils.replace("any", *, *, 0) = "any" StringUtils.replace("abaa", "a", null, -1) = "abaa" StringUtils.replace("abaa", "a", "", -1) = "b" StringUtils.replace("abaa", "a", "z", 0) = "abaa" StringUtils.replace("abaa", "a", "z", 1) = "zbaa" StringUtils.replace("abaa", "a", "z", 2) = "zbza" StringUtils.replace("abaa", "a", "z", -1) = "zbzz"- Parameters:
- text- text to search and replace in, may be null
- searchString- the String to search for, may be null
- replacement- the String to replace it with, may be null
- max- maximum number of values to replace, or- -1if no maximum
- Returns:
- the text with any replacements processed,
  nullif null String input
 
- 
replaceEachReplaces all occurrences of Strings within another String. A nullreference passed to this method is a no-op, or if any "search string" or "string to replace" is null, that replace will be ignored. This will not repeat. For repeating replaces, call the overloaded method.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" (example of how it does not repeat) StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}) = "dcte"- Parameters:
- text- text to search and replace in, no-op if null
- searchList- the Strings to search for, no-op if null
- replacementList- the Strings to replace them with, no-op if null
- Returns:
- the text with any replacements processed, nullif null String input
- Throws:
- IndexOutOfBoundsException- if the lengths of the arrays are not the same (null is ok, and/or size 0)
- Since:
- 2.4
 
- 
joinJoins the elements of the provided array into a single String containing the provided list of elements. No separator is added to the joined String. Null objects or empty strings within the array are represented by empty strings. StringUtils.join(null) = null StringUtils.join([]) = "" StringUtils.join([null]) = "" StringUtils.join(["a", "b", "c"]) = "abc" StringUtils.join([null, "", "a"]) = "a" - Type Parameters:
- T- the specific type of values to join together
- Parameters:
- elements- the values to join together, may be null
- Returns:
- the joined String, nullif null array input
- Since:
- 2.0, 3.0 Changed signature to use varargs
 
- 
joinJoins the elements of the provided array into a single String containing the provided list of elements. No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings. StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join(["a", "b", "c"], ';') = "a;b;c" StringUtils.join(["a", "b", "c"], null) = "abc" StringUtils.join([null, "", "a"], ';') = ";;a" - Parameters:
- array- the array of values to join together, may be null
- separator- the separator character to use
- Returns:
- the joined String, nullif null array input
- Since:
- 2.0
 
- 
joinJoins the elements of the provided array into a single String containing the provided list of elements. No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings. StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join(["a", "b", "c"], ';') = "a;b;c" StringUtils.join(["a", "b", "c"], null) = "abc" StringUtils.join([null, "", "a"], ';') = ";;a" - Parameters:
- array- the array of values to join together, may be null
- separator- the separator character to use
- startIndex- the first index to start joining from. It is an error to pass in an end index past the end of the array
- endIndex- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array
- Returns:
- the joined String, nullif null array input
- Since:
- 2.0
 
- 
joinJoins the elements of the provided array into a single String containing the provided list of elements. No delimiter is added before or after the list. A nullseparator is the same as an empty String (""). Null objects or empty strings within the array are represented by empty strings.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(["a", "b", "c"], "") = "abc" StringUtils.join([null, "", "a"], ',') = ",,a" - Parameters:
- array- the array of values to join together, may be null
- separator- the separator character to use, null treated as ""
- Returns:
- the joined String, nullif null array input
 
- 
joinJoins the elements of the provided array into a single String containing the provided list of elements. No delimiter is added before or after the list. A nullseparator is the same as an empty String (""). Null objects or empty strings within the array are represented by empty strings.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(["a", "b", "c"], "") = "abc" StringUtils.join([null, "", "a"], ',') = ",,a" - Parameters:
- array- the array of values to join together, may be null
- separator- the separator character to use, null treated as ""
- startIndex- the first index to start joining from. It is an error to pass in an end index past the end of the array
- endIndex- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array
- Returns:
- the joined String, nullif null array input
 
- 
equalsCompares two strings for equality, where either one or both objects may be null.ObjectUtils.equals(null, null) = true ObjectUtils.equals(null, "") = false ObjectUtils.equals("", null) = false ObjectUtils.equals("", "") = true- Parameters:
- o1- the first object, may be- null
- o2- the second object, may be- null
- Returns:
- trueif the values of both objects are the same
 
- 
equalsCompares two objects for deep equality, where either one or both objects may be null.ObjectUtils.equals(null, null) = true ObjectUtils.equals(null, "") = false ObjectUtils.equals("", null) = false ObjectUtils.equals("", "") = true ObjectUtils.equals(Boolean.TRUE, null) = false ObjectUtils.equals(Boolean.TRUE, "true") = false ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE) = true ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false- Parameters:
- o1- the first object, may be- null
- o2- the second object, may be- null
- Returns:
- trueif the values of both objects are the same
 
- 
defaultIfNullpublic static <T> T defaultIfNull(T object, T defaultValue) Returns a default value if the object passed is null.ObjectUtils.defaultIfNull(null, null) = null ObjectUtils.defaultIfNull(null, "") = "" ObjectUtils.defaultIfNull(null, "zz") = "zz" ObjectUtils.defaultIfNull("abc", *) = "abc" ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE- Type Parameters:
- T- the type of the object
- Parameters:
- object- the- Objectto test, may be- null
- defaultValue- the default value to return, may be- null
- Returns:
- objectif it is not- null, defaultValue otherwise
 
- 
firstNonNullReturns the first non- nullargument.- Type Parameters:
- T- the type of the objects
- Parameters:
- objects- the elements to test, may not be- nullbut empty
- Returns:
- first non-nullelement inobjects, otherwisenull
 
- 
toCamelCaseConvert a string to camel case
- 
toCamelCaseLCConvert a string to camel case starting with a lower case letter
- 
toLCChange a string's first letter to lower case
- 
toLCChange a string's first letter to lower case
- 
toUCChange a string's first letter to upper case
- 
toUCChange a string's first letter to upper case
- 
splitA custom adaptation ofPattern.split(CharSequence, int).This is useful if the matched split-tokens should be returned as well. For example: split("e", "hello world") // ["h", "e", "llo world"] split("o", "hello world") // ["hell", "o", " w", "o", "rld"] split("[eo]", "hello world") // ["h", "e", "ll", "o", " w", "o", "rld"]The result will always be an odd-length array. 
 
-