Package com.rometools.utils
Class Strings
- java.lang.Object
-
- com.rometools.utils.Strings
-
public final class Strings extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisBlank(String s)Checks whether a String is null, empty or blank.static booleanisEmpty(String s)Checks whether a String is null or empty.static booleanisNotEmpty(String s)Checks whether a String is neither null nor empty.static booleanisNull(String s)Checks whether a String is null.static StringtoLowerCase(String s)null-safe lower-case conversion of a String.static Stringtrim(String s)Removes the whitespace at the beginning and end of a String.static StringtrimToEmpty(String s)Removes the whitespace at the beginning and end of a String.static StringtrimToNull(String s)Removes the whitespace at the beginning and end of a String.
-
-
-
Method Detail
-
isNull
public static boolean isNull(String s)
Checks whether a String is null.- Parameters:
s- The String to check- Returns:
- true when the String is null, false otherwise
-
isEmpty
public static boolean isEmpty(String s)
Checks whether a String is null or empty.- Parameters:
s- The String to check- Returns:
- true when the String is null or empty, false otherwise
-
isNotEmpty
public static boolean isNotEmpty(String s)
Checks whether a String is neither null nor empty.- Parameters:
s- The String to check- Returns:
- true when the String is neither null nor empty, false otherwise
-
isBlank
public static boolean isBlank(String s)
Checks whether a String is null, empty or blank.- Parameters:
s- The String to check- Returns:
- true when the String is null, empty or blank, false otherwise
-
trim
public static String trim(String s)
Removes the whitespace at the beginning and end of a String.- Parameters:
s- The String to trim, may be null- Returns:
- null when the input String is null, the trimmed String otherwise
-
trimToNull
public static String trimToNull(String s)
Removes the whitespace at the beginning and end of a String. When the String only contains whitespace, it returns null.- Parameters:
s- The String to trim, may be null- Returns:
- null when the input String is null or does only contain whitespace, the trimmed String otherwise
-
trimToEmpty
public static String trimToEmpty(String s)
Removes the whitespace at the beginning and end of a String. When the String only contains whitespace, it returns null.- Parameters:
s- The String to trim, may be null- Returns:
- null when the input String is null or does only contain whitespace, the trimmed String otherwise
-
-