Class StringUtils
java.lang.Object
ch.systemsx.cisd.common.shared.basic.string.StringUtils
Some utilities for
String.
Can be used from GWT code.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic final Stringabbreviate(String value, int maxLength) static final Stringcapitalize(String word) static final StringdefaultIfBlank(String str, String defaultStr) Returns defaultStr, if str is blank, or otherwise it returns str itself.static final StringemptyIfNull(String stringOrNull) Returns an empty string if given stringOrNull isnull, otherwise it returns stringOrNull itself.static final StringEscapes escapedChars characters in specified text.static final booleanWhether given value is blank or not.static final booleanWhether given value is blank or not.static final booleanisNotBlank(String value) Whether given value is not blank.static final StringJoins the elements of the provided array into a singleStringcontaining the provided list of elements.static final StringJoins the elements using comma as a separator.static final StringJoins the elements using comma as a separator.static final booleanReturnstrueif given regExp could be found in given value.static final booleanReturnstrueif given regExp could be found in given value.static final StringnullIfBlank(String value) Returnsnullif given value is blank.Returns the tokens found in str, where tokens are separated by white spaces.static final StringtoStringEmptyIfNull(Object objectOrNull) Returns an empty string if given objectOrNull isnull, otherwise it returns result ofObject.toString()on the object.static final StringtoStringOrNull(Object objectOrNull) Returns null if given objectOrNull isnull, otherwise it returns result ofObject.toString()on the object.static final StringtrimToNull(String value) Trims given value tonull.
-
Field Details
-
EMPTY_STRING
- See Also:
-
EMPTY_STRING_ARRAY
-
-
Method Details
-
isBlank
Whether given value is blank or not. -
isBlank
Whether given value is blank or not. -
isNotBlank
Whether given value is not blank. -
joinList
Joins the elements using comma as a separator.
Example: "a", "b", "c" -> "a, b, c" -
joinList
Joins the elements using comma as a separator.
Example: "a", "b", "c" -> "a, b, c" -
join
Joins the elements of the provided array into a singleStringcontaining the provided list of elements. -
capitalize
-
abbreviate
-
trimToNull
Trims given value tonull.- Returns:
nullif given value is blank.
-
nullIfBlank
Returnsnullif given value is blank. -
emptyIfNull
Returns an empty string if given stringOrNull isnull, otherwise it returns stringOrNull itself. -
toStringEmptyIfNull
Returns an empty string if given objectOrNull isnull, otherwise it returns result ofObject.toString()on the object. -
toStringOrNull
Returns null if given objectOrNull isnull, otherwise it returns result ofObject.toString()on the object. -
defaultIfBlank
Returns defaultStr, if str is blank, or otherwise it returns str itself. -
escape
Escapes escapedChars characters in specified text. -
tokenize
Returns the tokens found in str, where tokens are separated by white spaces. -
matches
Returnstrueif given regExp could be found in given value.Allowed modifiers are:
- i - Perform case-insensitive matching
- g - Perform a global match (find all matches rather than stopping after the first match)
- m - Perform multiline matching
-
matches
Returnstrueif given regExp could be found in given value.
-