Class PatternUtils

java.lang.Object
com.dianxin.tori.base.utils.PatternUtils

@ReleasedSince("26.8.301") public final class PatternUtils extends Object
Utility class containing pre-compiled regex patterns for string validation checks.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isOnlyDigits(@Nullable String ctx)
    Verifies whether the string consists strictly of numeric digits (0-9).
    static boolean
    isOnlyLetters(@Nullable String ctx)
    Verifies whether the string consists strictly of English alphabetic characters (a-z, A-Z).
    static boolean
    Verifies whether the string consists strictly of English letters and digits (a-z, A-Z, 0-9).
    static boolean
    isOnlyNumbers(@Nullable String ctx)
    Verifies whether the string constitutes a valid numeric scalar (supports negative signs and decimals).

    Methods inherited from class java.lang.Object

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

    • isOnlyDigits

      public static boolean isOnlyDigits(@Nullable @Nullable String ctx)
      Verifies whether the string consists strictly of numeric digits (0-9).
      Parameters:
      ctx - the input string to test
      Returns:
      true if non-null and containing only digits, otherwise false
    • isOnlyLetters

      public static boolean isOnlyLetters(@Nullable @Nullable String ctx)
      Verifies whether the string consists strictly of English alphabetic characters (a-z, A-Z).
      Parameters:
      ctx - the input string to test
      Returns:
      true if non-null and containing only letters, otherwise false
    • isOnlyNumbers

      public static boolean isOnlyNumbers(@Nullable @Nullable String ctx)
      Verifies whether the string constitutes a valid numeric scalar (supports negative signs and decimals).
      Parameters:
      ctx - the input string to test
      Returns:
      true if the input parses as a numeric value, otherwise false
    • isOnlyLettersAndDigits

      public static boolean isOnlyLettersAndDigits(@Nullable @Nullable String ctx)
      Verifies whether the string consists strictly of English letters and digits (a-z, A-Z, 0-9).
      Parameters:
      ctx - the input string to test
      Returns:
      true if non-null and containing alphanumeric characters only, otherwise false