Class BlueMindText
java.lang.Object
org.exoplatform.bluemind.client.util.BlueMindText
The few text helpers the client needs, so that it depends on the JDK alone
rather than on
commons-lang3 — the copied classes used
StringUtils for exactly these four.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdefaultIfNull(String text, String replacement) A text, or a replacement when it is null.static booleanWhether a text is null, empty or only whitespace.static StringsubstringBefore(String text, String separator) What precedes the first occurrence of a separator, or the whole text when it holds none.static StringtrimToNull(String text) A text trimmed, or null when nothing is left.
-
Method Details
-
isBlank
Whether a text is null, empty or only whitespace.- Parameters:
text- the text, possibly null- Returns:
- true when there is nothing in it
-
trimToNull
A text trimmed, or null when nothing is left.- Parameters:
text- the text, possibly null- Returns:
- the trimmed text, or null when it was null or blank
-
defaultIfNull
A text, or a replacement when it is null.- Parameters:
text- the text, possibly nullreplacement- what to answer instead of null- Returns:
- the text, or the replacement
-
substringBefore
What precedes the first occurrence of a separator, or the whole text when it holds none.- Parameters:
text- the textseparator- the separator- Returns:
- the part before the separator
-