Name

StringFormat

Synopsis

Class Name:

com.ora.jsp.util.StringFormat

Extends:

None

Implements:

None

Description

The StringFormat 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 browser interpretation problems.

Class Summary

public class StringFormat {
  // Methods
  public static boolean isValidDate(String dateString,
    String dateFormatPattern);
  public static boolean isValidEmailAddr(String emailAddrString);
  public static boolean isValidInteger(String numberString,
    int min, int max);
  public static boolean isValidString(String value,
    String[] validStrings, boolean ignoreCase);
  public static String replaceInString(String in, String from,
    String to);
  public static java.util.Date toDate(String dateString,
    String dateFormatPattern) throws java.text.ParseException;
  public static String toHTMLString(String in);
  public static Number toNumber(String numString,
    String numFormatPattern) throws java.text.ParseException;
}

Methods

public static boolean isValidDate(String dateString, String dateFormatPattern)

Returns true if the specified date string represents a valid date in the specified format. The dateFormatPattern is 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 isValidEmailAddr(String ...

Get Java Server Pages 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.