Name
StringFormat
Synopsis
The StringFormat
class contains a number of static methods
that can validate the format of strings, typically received as input
from a user, and to format values as strings that can be used in HTML
output without causing browser-interpretation problems.
Synopsis
Class Name: |
|
Extends: |
None |
Implements: |
None |
Methods
-
public static boolean isValidDate(String dateString, String dateFormatPattern)
Returns
true
if the specified date string represents a valid date in the specified format. ThedateFormatPattern
is aString
specifying the format to be used when parsing thedateString
. The pattern is expressed with the pattern letters defined for thejava.text.SimpleDateFormat
class.-
public static boolean isValidEmailAddr(String emailAddrString)
Returns
true
if the email string contains only one at-sign, except as the first or last character, no whitespace and at least one dot after the at-sign, except as the first or last character. Note! This rule isn’t always correct (e.g., on an intranet it may be okay with just a name) and it doesn’t guarantee a valid Internet email address, but it takes care of the most obvious Internet mail address format errors.-
public static boolean isValidInteger(String numberString, int min, int max)
Returns
true
if the specified number string represents a valid integer in the specified range.-
public static boolean isValidString(String value,
String[] validStrings, boolean ignoreCase)
Returns ...
Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.