ValidationUtil
Kind of class: | class |
---|---|
Inherits from: | none |
Version: | 05/02/07 |
Author: | Aaron Clinger |
Classpath: | org.casalib.util.ValidationUtil |
File last modified: | Monday, 01 December 2008, 13:34:40 |
Summary
Class methods
- isEmail (email:String) : Boolean
- Determines if string is a valid email address.
- isPhone (phone:String) : Boolean
- Determines if numbers in string are equal to or greater than a valid phone number length.
- isZip (zip:String) : Boolean
- Determines if numbers in string are a valid US zip code length.
- isStateAbbreviation (state:String) : Boolean
- Determines if string is a valid state abbreviation.
- contains (source:String, search:String) : Boolean
- Determines if string contains search string.
- isEmpty (source:String) : Boolean
- Determines if string is blank or contains only tabs, linefeeds, carriage returns and spaces.
- isCreditCard (cardNumber:String) : Boolean
- Determines if credit card is valid using the Luhn formula.
- getCreditCardProvider (cardNumber:String) : String
- Determines US credit card provider by card number.
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; otherwisefalse
.
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; otherwisefalse
.
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; otherwisefalse
.
isEmpty
static function isEmpty (
source:String) : Boolean
Determines if string is blank or contains only tabs, linefeeds, carriage returns and spaces.
Parameters:
source:
String to check if empty.
Returns:
- Returns
true
if string is empty; otherwisefalse
.
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; otherwisefalse
.
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; otherwisefalse
.
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; otherwisefalse
.