Class StringUtils

java.lang.Object
com.flexganttfx.core.StringUtils

public class StringUtils
extends Object
A couple of utility methods for working with strings.
Since:
1.0
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • isEmpty

      public static boolean isEmpty​(String str)

      Checks if a String is empty ("") or null.

       StringUtils.isEmpty(null)      = true
       StringUtils.isEmpty("")        = true
       StringUtils.isEmpty(" ")       = false
       StringUtils.isEmpty("bob")     = false
       StringUtils.isEmpty("  bob  ") = false
       
      Parameters:
      str - the String to check, may be null
      Returns:
      true if the String is empty or null
      Since:
      1.0
    • isNotEmpty

      public static boolean isNotEmpty​(String str)

      Checks if a String is not empty ("") and not null.

       StringUtils.isNotEmpty(null)      = false
       StringUtils.isNotEmpty("")        = false
       StringUtils.isNotEmpty(" ")       = true
       StringUtils.isNotEmpty("bob")     = true
       StringUtils.isNotEmpty("  bob  ") = true
       
      Parameters:
      str - the String to check, may be null
      Returns:
      true if the String is not empty and not null
      Since:
      1.0
    • isBlank

      public static boolean isBlank​(String str)

      Checks if a String is whitespace, empty ("") or null.

       StringUtils.isBlank(null)      = true
       StringUtils.isBlank("")        = true
       StringUtils.isBlank(" ")       = true
       StringUtils.isBlank("bob")     = false
       StringUtils.isBlank("  bob  ") = false
       
      Parameters:
      str - the String to check, may be null
      Returns:
      true if the String is null, empty or whitespace
      Since:
      1.0
    • isNotBlank

      public static boolean isNotBlank​(String str)

      Checks if a String is not empty (""), not null and not whitespace only.

       StringUtils.isNotBlank(null)      = false
       StringUtils.isNotBlank("")        = false
       StringUtils.isNotBlank(" ")       = false
       StringUtils.isNotBlank("bob")     = true
       StringUtils.isNotBlank("  bob  ") = true
       
      Parameters:
      str - the String to check, may be null
      Returns:
      true if the String is not empty and not null and not whitespace
      Since:
      1.0