Class Strings


  • public final class Strings
    extends Object
    • 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
      • toLowerCase

        public static String toLowerCase​(String s)
        null-safe lower-case conversion of a String.
        Parameters:
        s - The String to process, may be null
        Returns:
        null when the input String is null, the String in lower-case otherwise