Constructor and Description |
---|
Valid() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isAllowed(String str,
String allowedChars)
Returns true if the specified string only contains the
allowed characters.
|
static boolean |
isEmpty(String str) |
static boolean |
isFloatOnly(String str)
Ensures that the string is composed of only floating point
numbers (digits [0-9] and maybe a "."), with optional
leading/trailing blanks.
|
static boolean |
isIntegerOnly(String str)
Ensures that the string is composed of only an digits [0-9] with
optional leading/trailing blanks.
|
static boolean |
isNotAllowed(String str,
String unallowedChars)
Returns true if the specified string has no unallowed
characters.
|
static boolean |
isNotEmpty(String str)
Returns true is the specified string is not null and
not empty ("").
|
static boolean |
length(String str,
int min,
int max)
Returns true if the string is non-empty and it's length
is between the specified min and max lengths (both inclusive).
|
static void |
main(String[] args) |
static void |
setTrimSpaces(boolean val)
If set to true, methods in this class will trim the string
entered by the user before attempting to run further validation on it,
else strings will not be trimmed automatically.
|
public Valid()
public static void setTrimSpaces(boolean val)
public static boolean isIntegerOnly(String str)
public static boolean isFloatOnly(String str)
public static boolean isNotEmpty(String str)
public static boolean length(String str, int min, int max)
public static boolean isAllowed(String str, String allowedChars)
public static boolean isNotAllowed(String str, String unallowedChars)