Class StringUtils

java.lang.Object
com.aispect.common.util.StringUtils

public final class StringUtils extends Object
Public utility class for string processing.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Check the given CharSequence Is it empty ("")、for null or contain only whitespace characters.
    static boolean
    Check the given CharSequence Whether it is not empty ("")、Not for null And not all whitespace characters.
    static boolean
    toBoolean(String str, boolean defaultValue)
    Safely convert a string to boolean。If the string is "true"(Ignoring case), return true。 If the string is empty, the default value is returned.
    static int
    toInt(String str, int defaultValue)
    Safely convert a string to int,If the conversion fails or the string is empty, the default value is returned.
    static long
    toLong(String str, long defaultValue)
    Safely convert a string to long,If the conversion fails or the string is empty, the default value is returned.

    Methods inherited from class java.lang.Object

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

    • isBlank

      public static boolean isBlank(CharSequence cs)
      Check the given CharSequence Is it empty ("")、for null or contain only whitespace characters.
    • isNotBlank

      public static boolean isNotBlank(CharSequence cs)
      Check the given CharSequence Whether it is not empty ("")、Not for null And not all whitespace characters.
    • toInt

      public static int toInt(String str, int defaultValue)
      Safely convert a string to int,If the conversion fails or the string is empty, the default value is returned.
    • toLong

      public static long toLong(String str, long defaultValue)
      Safely convert a string to long,If the conversion fails or the string is empty, the default value is returned.
    • toBoolean

      public static boolean toBoolean(String str, boolean defaultValue)
      Safely convert a string to boolean。If the string is "true"(Ignoring case), return true。 If the string is empty, the default value is returned.