Package org.apache.bval.util
Class StringUtils
- java.lang.Object
-
- org.apache.bval.util.StringUtils
-
public final class StringUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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 aString
representation ofo
, accounting for array types.
-
-
-
Method Detail
-
capitalize
public static String capitalize(String str)
Taken from commons-lang3.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
WordUtils.capitalize(String)
. Anull
input String returnsnull
.StringUtils.capitalize(null) = null StringUtils.capitalize("") = "" StringUtils.capitalize("cat") = "Cat" StringUtils.capitalize("cAt") = "CAt" StringUtils.capitalize("'cat'") = "'cat'"
- Parameters:
str
- the String to capitalize, may be null- Returns:
- the capitalized String,
null
if null String input - See Also:
WordUtils.capitalize(String)
-
isBlank
public static boolean isBlank(CharSequence cs)
Taken from commons-lang3.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
- Parameters:
cs
- the CharSequence to check, may be null- Returns:
true
if the CharSequence is null, empty or whitespace
-
isNotBlank
public static boolean isNotBlank(CharSequence cs)
Taken from commons-lang3.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
- Parameters:
cs
- the CharSequence to check, may be null- Returns:
true
if the CharSequence is not empty and not null and not whitespace
-
split
public static String[] split(String str)
Splits the provided text into an array, separator is whitespace.
- Parameters:
str
-- Returns:
String
[]
-
split
public static String[] split(String str, Character token)
Splits the provided text into an array, separator is whitespace.
- Parameters:
str
-token
-- Returns:
String
[]
-
-