Package com.dianxin.tori.base.utils
Class PatternUtils
java.lang.Object
com.dianxin.tori.base.utils.PatternUtils
Utility class containing pre-compiled regex patterns for string validation checks.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisOnlyDigits(@Nullable String ctx) Verifies whether the string consists strictly of numeric digits (0-9).static booleanisOnlyLetters(@Nullable String ctx) Verifies whether the string consists strictly of English alphabetic characters (a-z, A-Z).static booleanisOnlyLettersAndDigits(@Nullable String ctx) Verifies whether the string consists strictly of English letters and digits (a-z, A-Z, 0-9).static booleanisOnlyNumbers(@Nullable String ctx) Verifies whether the string constitutes a valid numeric scalar (supports negative signs and decimals).
-
Method Details
-
isOnlyDigits
Verifies whether the string consists strictly of numeric digits (0-9).- Parameters:
ctx- the input string to test- Returns:
trueif non-null and containing only digits, otherwisefalse
-
isOnlyLetters
Verifies whether the string consists strictly of English alphabetic characters (a-z, A-Z).- Parameters:
ctx- the input string to test- Returns:
trueif non-null and containing only letters, otherwisefalse
-
isOnlyNumbers
Verifies whether the string constitutes a valid numeric scalar (supports negative signs and decimals).- Parameters:
ctx- the input string to test- Returns:
trueif the input parses as a numeric value, otherwisefalse
-
isOnlyLettersAndDigits
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:
trueif non-null and containing alphanumeric characters only, otherwisefalse
-