public final class StringUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
capitalize(String str)
Taken from commons-lang3.
|
static boolean |
isBlank(CharSequence cs)
Taken from commons-lang3.
|
static boolean |
isNotBlank(CharSequence cs)
Taken from commons-lang3.
|
static String[] |
split(String str)
Splits the provided text into an array, separator is whitespace.
|
static String[] |
split(String str,
Character token)
Splits the provided text into an array, separator is whitespace.
|
static String |
valueOf(Object o)
Return a
String representation of o, accounting for array types. |
public static String capitalize(String str)
Capitalizes a String changing the first character to title case as
per Character.toTitleCase(char). No other characters are changed.
For a word based algorithm, see org.apache.commons.lang3.text.WordUtils#capitalize(String).
A null input String returns null.
StringUtils.capitalize(null) = null
StringUtils.capitalize("") = ""
StringUtils.capitalize("cat") = "Cat"
StringUtils.capitalize("cAt") = "CAt"
StringUtils.capitalize("'cat'") = "'cat'"
str - the String to capitalize, may be nullnull if null String inputorg.apache.commons.lang3.text.WordUtils#capitalize(String)public static boolean isBlank(CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
StringUtils.isBlank(null) = true
StringUtils.isBlank("") = true
StringUtils.isBlank(" ") = true
StringUtils.isBlank("bob") = false
StringUtils.isBlank(" bob ") = false
cs - the CharSequence to check, may be nulltrue if the CharSequence is null, empty or whitespacepublic static boolean isNotBlank(CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
StringUtils.isNotBlank(null) = false
StringUtils.isNotBlank("") = false
StringUtils.isNotBlank(" ") = false
StringUtils.isNotBlank("bob") = true
StringUtils.isNotBlank(" bob ") = true
cs - the CharSequence to check, may be nulltrue if the CharSequence is
not empty and not null and not whitespacepublic static String[] split(String str)
Splits the provided text into an array, separator is whitespace.
str - String[]public static String[] split(String str, Character token)
Splits the provided text into an array, separator is whitespace.
str - token - String[]Copyright © 2010–2020 The Apache Software Foundation. All rights reserved.