Class Strings


  • public final class Strings
    extends java.lang.Object
    Utility class providing String related functions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isEmpty​(@Nullable java.lang.String s)
      Checks whether a String is empty.
      static boolean notEmpty​(@Nullable java.lang.String s)
      Checks whether a String is not empty.
      static java.lang.String safe​(@Nullable java.lang.String s)
      Makes sure a String is not null.
      • Methods inherited from class java.lang.Object

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

      • isEmpty

        public static boolean isEmpty​(@Nullable java.lang.String s)
        Checks whether a String is empty.

        A String is considered empty if it is either null or of length 0.

        Parameters:
        s - the String to check.
        Returns:
        true if the string is empty.
      • notEmpty

        public static boolean notEmpty​(@Nullable java.lang.String s)
        Checks whether a String is not empty.

        A String is considered empty if it is either null or of length 0.

        Parameters:
        s - the String to check.
        Returns:
        true if the string is not empty.
      • safe

        public static java.lang.String safe​(@Nullable java.lang.String s)
        Makes sure a String is not null.
        Parameters:
        s - the String to check.
        Returns:
        the submitted String or "" if null was submitted.