|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ora.jsp.util.StringFormat
This class contains a number of static methods that can be used to 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 interpretation problems.
Field Summary | |
private static java.text.SimpleDateFormat |
dateFormat
|
private static java.text.DecimalFormat |
numberFormat
|
Constructor Summary | |
StringFormat()
|
Method Summary | |
static boolean |
isValidDate(java.lang.String dateString,
java.lang.String dateFormatPattern)
Returns true if the specified date string represents a valid date in the specified format, using the default Locale. |
static boolean |
isValidEmailAddr(java.lang.String mailAddr)
Returns true if the string is in the format of a valid SMTP mail address: only one at-sign, except as the first or last character, no white-space and at least one dot after the at-sign, except as the first or last character. |
static boolean |
isValidInteger(java.lang.String numberString,
int min,
int max)
Returns true if the specified number string represents a valid integer in the specified range, using the default Locale. |
static boolean |
isValidString(java.lang.String[] values,
java.lang.String[] validStrings,
boolean ignoreCase)
Returns true if the strings in the specified array all match a string in the set of provided valid strings, ignoring case if specified. |
static boolean |
isValidString(java.lang.String value,
java.lang.String[] validStrings,
boolean ignoreCase)
Returns true if the specified string matches a string in the set of provided valid strings, ignoring case if specified. |
static java.lang.String |
replaceInString(java.lang.String in,
java.lang.String from,
java.lang.String to)
Replaces one string with another throughout a source string. |
static java.lang.String |
toContextRelativeURI(java.lang.String relURI,
java.lang.String currURI)
Returns a page-relative or context-relative path URI as a context-relative URI. |
static java.util.Date |
toDate(java.lang.String dateString,
java.lang.String dateFormatPattern)
Converts a String to a Date, using the specified pattern. |
static java.lang.String |
toHTMLString(java.lang.String in)
Returns the specified string converted to a format suitable for HTML. |
static java.lang.Number |
toNumber(java.lang.String numString,
java.lang.String numFormatPattern)
Converts a String to a Number, using the specified pattern. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.text.SimpleDateFormat dateFormat
private static java.text.DecimalFormat numberFormat
Constructor Detail |
public StringFormat()
Method Detail |
public static boolean isValidDate(java.lang.String dateString, java.lang.String dateFormatPattern)
dateString
- a String representing a date/time.dateFormatPattern
- a String specifying the format to be used
when parsing the dateString. The pattern is expressed with the
pattern letters defined for the java.text.SimpleDateFormat class.
public static boolean isValidInteger(java.lang.String numberString, int min, int max)
numberString
- a String representing an integermin
- the minimal value in the valid rangemax
- the maximal value in the valid range
public static boolean isValidEmailAddr(java.lang.String mailAddr)
Note! This rule is not always correct (e.g. on an intranet it may be okay with just a name) and it does not guarantee a valid Internet email address but it takes care of the most obvious SMTP mail address format errors.
mailAddr
- a String representing an email address
public static boolean isValidString(java.lang.String value, java.lang.String[] validStrings, boolean ignoreCase)
value
- the String validatevalidStrings
- an array of valid StringsignoreCase
- if true, case is ignored when comparing the value
to the set of validStrings
public static boolean isValidString(java.lang.String[] values, java.lang.String[] validStrings, boolean ignoreCase)
values
- the String[] validatevalidStrings
- an array of valid StringsignoreCase
- if true, case is ignored when comparing the value
to the set of validStrings
public static java.lang.String toHTMLString(java.lang.String in)
in
- the String to convert
public static java.util.Date toDate(java.lang.String dateString, java.lang.String dateFormatPattern) throws java.text.ParseException
dateString
- the String to convertdateFormatPattern
- the pattern
ParseException,
- if the String doesn't match the pattern
java.text.ParseException
public static java.lang.Number toNumber(java.lang.String numString, java.lang.String numFormatPattern) throws java.text.ParseException
numString
- the String to convertnumFormatPattern
- the pattern
ParseException,
- if the String doesn't match the pattern
java.text.ParseException
public static java.lang.String replaceInString(java.lang.String in, java.lang.String from, java.lang.String to)
in
- the source Stringfrom
- the sub String to replaceto
- the sub String to replace with
public static java.lang.String toContextRelativeURI(java.lang.String relURI, java.lang.String currURI) throws java.lang.IllegalArgumentException
relURI
- the page or context-relative URIcurrURI
- the context-relative URI for the current request
java.lang.IllegalArgumentException
- if the relURI is invalid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |