com.perdues.db
Class Validate

java.lang.Object
  |
  +--com.perdues.db.Validate

public class Validate
extends java.lang.Object

Methods related to data validation.


Method Summary
static boolean okBoolean(java.lang.String sBoolean)
          A boolean in a form is valid if it is "0" or "1".
static boolean okEmail(java.lang.String email)
          Rough validation of an email address.
static boolean okPhone(java.lang.String phone)
          Very generic phone number validator.
static int okPhoneDigits(java.lang.String phone)
          As okPhone, but returns the number of digits before the first "x", or a negative number if the input is not valid.
static boolean okSSN(java.lang.String ssn)
          Social Security Number (SSN) validator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

okBoolean

public static boolean okBoolean(java.lang.String sBoolean)
A boolean in a form is valid if it is "0" or "1".

okEmail

public static boolean okEmail(java.lang.String email)
Rough validation of an email address. Checks for a domain ("@"), a "." in the domain part. Only graphic ASCII characters pass this test. No angle brackets, parentheses, or double quotes; all are email address header syntax.

okPhone

public static boolean okPhone(java.lang.String phone)
Very generic phone number validator. Allows digits, hyphens, parentheses, digits, and the letter 'x' to indicate an extension. Any number of digits. Digits must be ASCII.

okPhoneDigits

public static int okPhoneDigits(java.lang.String phone)
As okPhone, but returns the number of digits before the first "x", or a negative number if the input is not valid.

okSSN

public static boolean okSSN(java.lang.String ssn)
Social Security Number (SSN) validator. Requires exactly 9 ASCII digits interspersed with spaces and dashes.