Class StringUtils


  • public final class StringUtils
    extends java.lang.Object
    Utilities for String.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isBlank​(java.lang.String string)
      Check if the String is null or has only whitespaces.
      static boolean isEmpty​(java.lang.String string)
      Check if the String is null or empty.
      static boolean isNotBlank​(java.lang.String string)
      Check if the String has any non-whitespace character.
      static boolean isNotEmpty​(java.lang.String string)
      Check if the String has any character.
      static java.lang.String truncate​(java.lang.String string, int maxLength)
      Truncate the String to the max length.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isBlank

        public static boolean isBlank​(@Nullable
                                      java.lang.String string)
        Check if the String is null or has only whitespaces. Modified from StringUtils.isBlank(String).
        Parameters:
        string - String to check
        Returns:
        true if the String is null or has only whitespaces
      • isNotBlank

        public static boolean isNotBlank​(@Nullable
                                         java.lang.String string)
        Check if the String has any non-whitespace character.
        Parameters:
        string - String to check
        Returns:
        true if the String has any non-whitespace character
      • isEmpty

        public static boolean isEmpty​(@Nullable
                                      java.lang.String string)
        Check if the String is null or empty.
        Parameters:
        string - String to check
        Returns:
        true if the String is null or empty
      • isNotEmpty

        public static boolean isNotEmpty​(@Nullable
                                         java.lang.String string)
        Check if the String has any character.
        Parameters:
        string - String to check
        Returns:
        true if the String has any character
        Since:
        1.1.0
      • truncate

        public static java.lang.String truncate​(java.lang.String string,
                                                int maxLength)
        Truncate the String to the max length.
        Parameters:
        string - String to truncate
        maxLength - max length
        Returns:
        truncated String