ValidationUtil

Kind of class:class
Inherits from:none
Version:03/21/07
Author:Aaron Clinger
Classpath:org.casaframework.util.ValidationUtil
File last modified:Monday, 02 April 2007, 14:45:54

Class methods

contains

static function contains (
source:String, search:String) : Boolean
Determines if string contains search string.
Parameters:
source:
String to search in.
search:
String to search for.
Returns:
Returns true if source string contains search string; otherwise false.

getCreditCardProvider

static function getCreditCardProvider (
cardNumber:String) : String
Determines US credit card provider by card number.
Parameters:
cardNumber:
The credit card number.
Returns:
Returns name of the provider; values can be "visa", "mastercard", "discover", "amex", "diners", "other" or "invalid".

isCreditCard

static function isCreditCard (
cardNumber:String) : Boolean
Determines if credit card is valid using the Luhn formula.
Parameters:
cardNumber:
The credit card number.
Returns:
Returns true if string is a valid credit card number; otherwise false.

isEmail

static function isEmail (
email:String) : Boolean
Determines if string is a valid email address.
Parameters:
email:
String to verify as email.
Returns:
Returns true if string is a valid email; otherwise false.

isEmpty

static function isEmpty (
source:String) : Boolean
Determines if string is blank or contains only spaces.
Parameters:
source:
String to check if empty.
Returns:
Returns true if string is empty; otherwise false.

isPhone

static function isPhone (
phone:String) : Boolean
Determines if numbers in string are equal to or greater than a valid phone number length.
Parameters:
phone:
String to verify the containing numbers are equal or above 10 numbers in length.
Returns:
Returns true if phone number; otherwise false.

isStateAbbreviation

static function isStateAbbreviation (
state:String) : Boolean
Determines if string is a valid state abbreviation.
Parameters:
state:
String to verify as two letter state abbreviation (includes DC).
Returns:
Returns true if string is a state abbreviation; otherwise false.

isZip

static function isZip (
zip:String) : Boolean
Determines if numbers in string are a valid US zip code length.
Parameters:
zip:
String to verify the containing numbers are either 5 or 9 numbers in length.
Returns:
Returns true if zip code; otherwise false.