Package org.togglz.core.util
Class Strings
java.lang.Object
org.togglz.core.util.Strings
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleanReturns whether the specified string is empty while remaining null-safe.static booleanisNotBlank(String s) static booleanisNotEmpty(String s) Returns whether the specified string is not empty while remaining null-safe.static Stringstatic StringjoinClassNames(Iterable<?> iterable) splitAndTrim(String value, String regex) static BooleanAttempts to return the best boolean representation for the specified string while remaining null-safe and ignoring any leading/trailing whitespace as well as case.static StringTrims the specified string while remaining null-safe.static StringtrimToNull(String s) Trims the specified string and, if the resulting string is empty, will return null instead.
-
Constructor Details
-
Strings
public Strings()
-
-
Method Details
-
join
-
isBlank
-
isNotBlank
-
isEmpty
Returns whether the specified string is empty while remaining null-safe.
- Parameters:
s- the string to be checked (may be null)- Returns:
- true if
sis either null or contains no characters.
-
isNotEmpty
Returns whether the specified string is not empty while remaining null-safe.
- Parameters:
s- the string to be checked (may be null)- Returns:
- true if
sis not null and contains at least one character.
-
splitAndTrim
-
trim
Trims the specified string while remaining null-safe.
- Parameters:
s- the string to be trimmed (may be null)- Returns:
- The trimmed
sor null ifsis null.
-
trimToNull
Trims the specified string and, if the resulting string is empty, will return null instead.
- Parameters:
s- the string to be trimmed (may be null)- Returns:
- The trimmed
sor null ifsis null before or after being trimmed.
-
joinClassNames
-
toBoolean
Attempts to return the best boolean representation for the specified string while remaining null-safe and ignoring any leading/trailing whitespace as well as case.
This method simply uses a set of predefined values that it compares
sto in order to determine the bestBooleanrepresentation. Ifsdoes not fall into either category, it is considered invalid and will result in anIllegalArgumentExceptionbeing thrown.- Parameters:
s- the string to be converted into aBoolean- Returns:
- The
Booleanrepresentation ofsor null ifsis null. - Throws:
IllegalArgumentException- Ifsis non-null and does not match any of the predefined values.
-