Class StringUtils


  • public class StringUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      StringUtils()
      should not be used
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean equals​(java.lang.String str1, java.lang.String str2)
      Compares two Strings
      static boolean isBlank​(java.lang.String s)
      Checks if a String is empty (""), null or whitespace only.
      static boolean isEmpty​(java.lang.String s)
      Checks if a String is empty ("") or null.
      static boolean isNotBlank​(java.lang.String s)
      Checks if a String is not empty (""), not null and not whitespace only.
      static java.lang.String trim​(java.lang.String str)
      Trim String, if null returns null
      static java.lang.String trimToEmpty​(java.lang.String str)
      Trim String, if null or empty returns empty
      static java.lang.String trimToNull​(java.lang.String str)
      Trim String, if null or empty returns null
      • Methods inherited from class java.lang.Object

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

      • StringUtils

        public StringUtils()
        should not be used
    • Method Detail

      • isEmpty

        public static boolean isEmpty​(java.lang.String s)
        Checks if a String is empty ("") or null.
        Parameters:
        s - the String to check, may be null
        Returns:
        true if the String is empty or null
      • isBlank

        public static boolean isBlank​(java.lang.String s)
        Checks if a String is empty (""), null or whitespace only.
        Parameters:
        s - the String to check, may be null
        Returns:
        true if the String is null, empty or whitespace only
      • isNotBlank

        public static boolean isNotBlank​(java.lang.String s)
        Checks if a String is not empty (""), not null and not whitespace only.
        Parameters:
        s - the String to check, may be null
        Returns:
        true if the CharSequence is not empty and not null and not whitespace only
      • trim

        public static java.lang.String trim​(java.lang.String str)
        Trim String, if null returns null
        Parameters:
        str - the String to be trimmed
        Returns:
        the trimmed string
      • trimToNull

        public static java.lang.String trimToNull​(java.lang.String str)
        Trim String, if null or empty returns null
        Parameters:
        str - the String to be trimmed
        Returns:
        the trimmed String
      • trimToEmpty

        public static java.lang.String trimToEmpty​(java.lang.String str)
        Trim String, if null or empty returns empty
        Parameters:
        str - the String to be trimmed
        Returns:
        the trimmed String
      • equals

        public static boolean equals​(java.lang.String str1,
                                     java.lang.String str2)
        Compares two Strings
        Parameters:
        str1 - the first String
        str2 - the second String
        Returns:
        true if the Strings are equal, case-sensitive