namespace
SAPO.Utility.Validator
set of functions to provide validation
Function Summary
validates if a zip code is valid in Portugal
can function in multiple ways
Ex:
cp1 = "2000" cp1 = "2000-123" cp1 = "2000 123" cp1 = "2000" & cp2 = "123"
cp1 = "2000" cp1 = "2000-123" cp1 = "2000 123" cp1 = "2000" & cp2 = "123"
validates the function in all country codes available or in the ones set in the second param
Boolean
isPortuguesePhone()
alias function for isPTPhone
Function Details
function codPostal
Boolean
codPostal(Number|String
cp1, [Number|String
cp2], [Boolean
returnBothResults])
validates if a zip code is valid in Portugal
can function in multiple ways
Ex:
cp1 = "2000" cp1 = "2000-123" cp1 = "2000 123" cp1 = "2000" & cp2 = "123"
cp1 = "2000" cp1 = "2000-123" cp1 = "2000 123" cp1 = "2000" & cp2 = "123"
Parameters:
cp1
[cp2]
[returnBothResults]
Returns:
true if zip code is valid
function isAOPhone
Boolean
isAOPhone(String
phone)
checks if a phone is valid in Angola
Parameters:
phone
Returns:
true if the number is valid
function isCVPhone
Boolean
isCVPhone(String
phone)
checks if a phone is valid in Cabo Verde
Parameters:
phone
Returns:
true if the number is valid
function isDate
Checks is a date is valid in a given format
Parameters:
format
- defined in _dateParsers
dateStr
- date string
Returns:
true if the date is valid in the format
function isMZPhone
Boolean
isMZPhone(String
phone)
checks if a phone is valid in Mozambique
Parameters:
phone
Returns:
true if the number is valid
function isPTPhone
Boolean
isPTPhone(String
phone)
checks if a phone is valid in Portugal
Parameters:
phone
Returns:
true if the number is valid
function isPhone
Boolean
isPhone(String
phone, [String|Array
country])
validates the function in all country codes available or in the ones set in the second param
Parameters:
phone
number
[country]
or array of countries to validate
List of countries available set in _countryCodes
Returns:
true if is valid
function isPortuguesePhone
Boolean
isPortuguesePhone()
alias function for isPTPhone
function isTLPhone
Boolean
isTLPhone(String
phone)
checks if a phone is valid in Timor
Parameters:
phone
Returns:
true if the number is valid
function mail
Boolean
mail(String
email)
checks if a email is valid
Parameters:
email
Returns:
true if the email is valid
function url
Boolean
url(String
url, Boolean
full)
checks if a url is valid
Parameters:
url
full
- if true, validates a full url (one which
starts with http)
Returns:
true if the url is valid