类 StringUtil

java.lang.Object
cn.vorbote.core.utils.StringUtil

public final class StringUtil extends Object
Miscellaneous String utility methods. This class comes org.springframework.util.StringUtils and made some changes to fit the standard in this lib. The original authors are:
  • Rod Johnson
  • Juergen Hoeller
  • Keith Donald
  • Rob Harrop
  • Rick Evans
  • Arjen Poutsma
  • Sam Brannen
  • Brian Clozel
Thanks for their huge efforts for this useful tool!
从以下版本开始:
16 April 2001
作者:
vorbote
  • 方法详细资料

    • isEmpty

      public static boolean isEmpty(Object str)
      Check whether the given String is empty.
      参数:
      str - The candidate string.
      返回:
      Value true while the candidate string is empty otherwise return value false.
    • hasLength

      public static boolean hasLength(CharSequence str)
      Check that the given CharSequence is neither null nor of length 0.
      参数:
      str - The CharSequence to check (maybe null).
      返回:
      Value true if the CharSequence is not null and has length.
    • hasLength

      public static boolean hasLength(String str)
      Check that the given String is neither null nor of length 0.
      参数:
      str - The String to check (maybe null).
      返回:
      Value true if the String is not null and has length.
    • hasText

      public static boolean hasText(CharSequence str)
      Check whether the given CharSequence contains actual text.
      参数:
      str - The CharSequence to check (maybe null)
      返回:
      Value true if the CharSequence is not null, its length is greater than 0, and it does not contain whitespace only.
    • doesNotHaveText

      public static boolean doesNotHaveText(CharSequence str)
      Check whether the given CharSequence contains actual text.
      参数:
      str - The CharSequence to check (maybe null)
      返回:
      Value true if the CharSequence is not null, its length is greater than 0, and it does not contain whitespace only.
    • hasText

      public static boolean hasText(String str)
      Check whether the given String contains actual text.
      参数:
      str - The String to check (maybe null)
      返回:
      Value true if the String is not null, its length is greater than 0, and it does not contain whitespace only.
    • doesNotHaveText

      public static boolean doesNotHaveText(String str)
      Check whether the given String contains actual text.
      参数:
      str - The String to check (maybe null)
      返回:
      Value true if the String is null, its length is less than 0, or it contains whitespace only.
    • containsWhitespace

      public static boolean containsWhitespace(CharSequence str)
      Check whether the given CharSequence contains any whitespace characters.
      参数:
      str - The CharSequence to check (maybe null).
      返回:
      Value true if the CharSequence is not empty and contains at lease 1 whitespace characters.
      另请参阅:
    • containsWhitespace

      public static boolean containsWhitespace(String str)
      Check whether the given String contains any whitespace characters.
      参数:
      str - The String to check (maybe null).
      返回:
      Value true if the String is not empty and contains at lease 1 whitespace characters.
      另请参阅:
    • trimWhitespace

      public static String trimWhitespace(String str)
      Trim leading and trailing whitespace from the given String.
      参数:
      str - The String to check.
      返回:
      The trimmed String.
      另请参阅:
    • trimAllWhitespace

      public static String trimAllWhitespace(String str)
      Trim all whitespace from the given String: leading, trailing, and in between characters.
      参数:
      str - The String to check.
      返回:
      The trimmed String.
      另请参阅:
    • count

      public static int count(String base, String substring)
      To count how many times does the substring in the base string.
      参数:
      base - The original string.
      substring - The substring.
      返回:
      The number of the count.
      另请参阅:
    • isEmpty

      public static boolean isEmpty(String val)
      Check the string is empty.
      参数:
      val - The string you want to check
      返回:
      True while the string is empty, otherwise return false
    • isNotEmpty

      public static boolean isNotEmpty(String val)
      Check the string is not empty.
      参数:
      val - The string you want to check
      返回:
      True while the string is not empty, otherwise return false
    • isBlank

      public static boolean isBlank(String val)
      Determine if the string contains only white space characters.
      参数:
      val - The string you want to check
      返回:
      True while the string is blank, otherwise return false. Blank means the string is meaningless, or it only got spaces or tabs in it.
    • format

      public static String format(String format, Object... args)
      Format any string using wild card of "{}".
      参数:
      format - The origin format string.
      args - The args to be put into the string.
      返回:
      An formatted string.