public class TextValidation extends Object
Constructor and Description |
---|
TextValidation() |
Modifier and Type | Method and Description |
---|---|
static void |
displayError(HTML widget,
String msg)
Set styles and display an error message
|
static void |
displayOkay(HTML widget,
String msg)
Set styles and display an "okay" message
|
static double |
parseDouble(String str)
Parse any double
|
static double |
parseDouble(String str,
double bound,
boolean lower)
Parse a double with a single lower or upper bound
|
static double |
parseDouble(String str,
double bound,
boolean lower,
boolean includeEndpoint)
Parse a double with a single upper or lower bound including the boundary
|
static double |
parseDouble(String str,
double lowerBound,
double upperBound,
boolean includeEndpoints)
Parse a double between the specified bounds
|
static String |
parseEmail(String str)
Parse a string as an email address and throw an exception
if not in the form email@domain.com.
|
static int |
parseInteger(String str,
double bound,
boolean lower)
Parse an integer with a single upper or lower bound
|
static int |
parseInteger(String str,
int lowerBound,
int upperBound)
Parse an integer between the specified bounds
|
static String |
parseString(String str)
Parse a string and throw an exception if disallowed characters appear
|
public static String parseString(String str) throws ParseException
str
- the string to be validatedParseException
public static String parseEmail(String str) throws ParseException
str
- email stringParseException
public static int parseInteger(String str, int lowerBound, int upperBound) throws NumberFormatException
str
- lowerBound
- upperBound
- NumberFormatException
public static int parseInteger(String str, double bound, boolean lower) throws NumberFormatException
str
- bound
- lower
- NumberFormatException
public static double parseDouble(String str, double lowerBound, double upperBound, boolean includeEndpoints) throws NumberFormatException
str
- lowerBound
- upperBound
- includeEndpoints
- NumberFormatException
public static double parseDouble(String str, double bound, boolean lower) throws NumberFormatException
str
- bound
- lower
- NumberFormatException
public static double parseDouble(String str, double bound, boolean lower, boolean includeEndpoint) throws NumberFormatException
str
- bound
- lower
- includeBoundary
- NumberFormatException
public static double parseDouble(String str) throws NumberFormatException
str
- NumberFormatException
public static void displayError(HTML widget, String msg)
widget
- msg
- public static void displayOkay(HTML widget, String msg)
widget
- msg
- University of Colorado Denver, Department of Biostatistics and Informatics