com.jdon.util
类 UtilValidate

java.lang.Object
  继承者 com.jdon.util.UtilValidate

public class UtilValidate
extends Object

General input/data validation methods

Utility methods for validating data, especially input. See detailed description below.

版本:
1.0
SUMMARY

This is a set of meethods for validating input. Functions are provided to validate:
- U.S. and international phone/fax numbers
- U.S. ZIP codes(5 or 9 digit postal codes)
- U.S. Postal Codes(2 letter abbreviations for names of states)
- U.S. Social Security Numbers(abbreviated as SSNs)
- email addresses
- dates(entry of year, month, and day and validity of combined date)
- credit card numbers

Supporting utility functions validate that:
- characters are Letter, Digit, or LetterOrDigit
- strings are a Signed, Positive, Negative, Nonpositive, or Nonnegative integer
- strings are a Float or a SignedFloat
- strings are Alphabetic, Alphanumeric, or Whitespace
- strings contain an integer within a specified range

Other utility functions are provided to:
- remove from a string characters which are/are not in a "bag" of selected characters
- strip whitespace/leading whitespace from a string

================================================================
NOTE: This code was adapted from the Netscape JavaScript form validation code, usually found in "FormChek.js".
Credit card verification functions Originally included as Starter Application 1.0.0 in LivePayment.
================================================================
作者:
David E. Jones

字段摘要
static String ContiguousUSStateCodes
          Valid contiguous U.S. postal codes
static String creditCardDelimiters
          non-digit characters which are allowed in credit card numbers
static int[] daysInMonth
          An array of ints representing the number of days in each month of the year.
static String decimalPointDelimiter
          decimal point character differs by language and culture
static boolean defaultEmptyOK
          boolean specifying by default whether or not it is okay for a String to be empty
static String digits
          digit characters
static int digitsInSocialSecurityNumber
          U.S.
static int digitsInUSPhoneAreaCode
           
static int digitsInUSPhoneMainNumber
           
static int digitsInUSPhoneNumber
          U.S. phone numbers have 10 digits.
static int digitsInZipCode1
          U.S.
static int digitsInZipCode2
          U.S.
static String isAnyCardMsg
           
static String isContiguousStateCodeMsg
           
static String isContiguousZipCodeMsg
           
static String isCreditCardPrefixMsg
           
static String isCreditCardSuffixMsg
           
static String isDateAfterToday
           
static String isDateMsg
           
static String isDatePrefixMsg
           
static String isDateSuffixMsg
           
static String isDayMsg
           
static String isEmailMsg
           
static String isFloatMsg
           
static String isHourMsg
           
static String isIntegerMsg
           
static String isInternationalPhoneNumberMsg
           
static String isLongMsg
           
static String isMinuteMsg
           
static String isMonthMsg
           
static String isNotEmptyMsg
           
static String isSecondMsg
           
static String isSignedDoubleMsg
           
static String isSignedFloatMsg
           
static String isSignedIntegerMsg
           
static String isSignedLongMsg
           
static String isSSNMsg
           
static String isStateCodeMsg
           
static String isTimeMsg
           
static String isUSPhoneAreaCodeMsg
           
static String isUSPhoneMainNumberMsg
           
static String isUSPhoneMsg
           
static String isYearMsg
           
static String isZipCodeMsg
           
static String letters
          letter characters
static String lowercaseLetters
          lower-case letter characters
static String phoneNumberDelimiters
          non-digit characters which are allowed in phone numbers
static String SSNDelimiters
          non-digit characters which are allowed in Social Security Numbers
static String uppercaseLetters
          upper-case letter characters
static String USStateCodeDelimiter
          Delimiter for USStateCodes String
static String USStateCodes
          Valid U.S.
static String validSSNChars
          characters which are allowed in Social Security Numbers
static String validUSPhoneChars
          characters which are allowed in US phone numbers
static String validWorldPhoneChars
          characters which are allowed in international phone numbers(a leading + is OK)
static String validZipCodeChars
          characters which are allowed in Social Security Numbers
static String whitespace
          whitespace characters
static String ZipCodeDelimeter
          our preferred delimiter for reformatting ZIP Codes
static String ZipCodeDelimiters
          non-digit characters which are allowed in ZIP Codes
 
构造方法摘要
UtilValidate()
           
 
方法摘要
static boolean areEqual(Object obj, Object obj2)
           
static boolean charInString(char c, String s)
          Returns true if single character c(actually a string) is contained within string s.
static int daysInFebruary(int year)
          Given integer argument year, returns number of days in February of that year.
static String getCardType(String ccPassed)
          Checks to see if the cc number is a valid number for any accepted credit card, and return the name of that type
static boolean isAlphabetic(String s)
          Returns true if string s is letters only.
static boolean isAlphanumeric(String s)
          Returns true if string s is English letters (A ..
static boolean isAmericanExpress(String cc)
          Checks to see if the cc number is a valid American Express number
static boolean isAnyCard(String ccPassed)
          Checks to see if the cc number is a valid number for any accepted credit card
static boolean isCardMatch(String cardType, String cardNumberPassed)
          Checks to see if the cc number is a valid number for the specified type
static boolean isCarteBlanche(String cc)
          Checks to see if the cc number is a valid Carte Blanche number
static boolean isContiguousStateCode(String s)
          Return true if s is a valid contiguous U.S.
static boolean isContiguousZipCode(String s)
          Returns true if string s is a valid contiguous U.S.
static boolean isCreditCard(String stPassed)
          Checks credit card number with Luhn Mod-10 test
static boolean isDate(String date)
          isDate returns true if string argument date forms a valid date.
static boolean isDate(String year, String month, String day)
          isDate returns true if string arguments year, month, and day form a valid date.
static boolean isDateAfterToday(String date)
          isDate returns true if string argument date forms a valid date and is after today.
static boolean isDay(String s)
          isDay returns true if string s is a valid day number between 1 and 31.
static boolean isDigit(char c)
          Returns true if character c is a digit (0 .. 9).
static boolean isDinersClub(String cc)
          Checks to see if the cc number is a valid Diners Club number
static boolean isDiscover(String cc)
          Checks to see if the cc number is a valid Discover number
static boolean isEmail(String s)
          Email address must be of form a@b.c -- in other words: - there must be at least one character before the @ - there must be at least one character before and after the
static boolean isEmpty(Collection c)
          Check whether collection c is empty.
static boolean isEmpty(String s)
          Check whether string s is empty.
static boolean isEnRoute(String cc)
          Checks to see if the cc number is a valid EnRoute number
static boolean isFloat(String s)
          True if string s is an unsigned floating point(real) number.
static boolean isHour(String s)
          isHour returns true if string s is a valid number between 0 and 23.
static boolean isInteger(String s)
          Returns true if all characters in string s are numbers.
static boolean isIntegerInRange(String s, int a, int b)
          isIntegerInRange returns true if string s is an integer within the range of integer arguments a and b, inclusive.
static boolean isInternationalPhoneNumber(String s)
          isInternationalPhoneNumber returns true if string s is a valid international phone number.
static boolean isJCB(String cc)
          Checks to see if the cc number is a valid JCB number
static boolean isLetter(char c)
          Returns true if character c is an English letter (A ..
static boolean isLetterOrDigit(char c)
          Returns true if character c is a letter or digit.
static boolean isMasterCard(String cc)
          Checks to see if the cc number is a valid Master Card number
static boolean isMinute(String s)
          isMinute returns true if string s is a valid number between 0 and 59.
static boolean isMonth(String s)
          isMonth returns true if string s is a valid month number between 1 and 12.
static boolean isNegativeInteger(String s)
          Returns true if string s is an integer < 0.
static boolean isNonnegativeInteger(String s)
          Returns true if string s is an integer >= 0.
static boolean isNonpositiveInteger(String s)
          Returns true if string s is an integer <= 0.
static boolean isNotEmpty(Collection c)
          Check whether collection c is NOT empty.
static boolean isNotEmpty(String s)
          Check whether string s is NOT empty.
static boolean isNotPoBox(String s)
          isNotPoBox returns true if address argument does not contain anything that looks like a a PO Box.
static boolean isPositiveInteger(String s)
          Returns true if string s is an integer > 0.
static boolean isSecond(String s)
          isSecond returns true if string s is a valid number between 0 and 59.
static boolean isSignedDouble(String s)
          True if string s is a signed or unsigned floating point (real) number.
static boolean isSignedFloat(String s)
          True if string s is a signed or unsigned floating point (real) number.
static boolean isSignedInteger(String s)
          Returns true if all characters are numbers; first character is allowed to be + or - as well.
static boolean isSignedLong(String s)
          Returns true if all characters are numbers; first character is allowed to be + or - as well.
static boolean isSSN(String s)
          isSSN returns true if string s is a valid U.S.
static boolean isStateCode(String s)
          Return true if s is a valid U.S.
static boolean isTime(String time)
          isTime returns true if string argument time forms a valid time.
static boolean isTime(String hour, String minute, String second)
          isTime returns true if string arguments hour, minute, and second form a valid time.
static boolean isUSPhoneAreaCode(String s)
          isUSPhoneAreaCode returns true if string s is a valid U.S.
static boolean isUSPhoneMainNumber(String s)
          isUSPhoneMainNumber returns true if string s is a valid U.S.
static boolean isUSPhoneNumber(String s)
          isUSPhoneNumber returns true if string s is a valid U.S.
static boolean isVisa(String cc)
          Checks to see if the cc number is a valid Visa number
static boolean isWhitespace(String s)
          Returns true if string s is empty or whitespace characters only.
static boolean isYear(String s)
          isYear returns true if string s is a valid Year number.
static boolean isZipCode(String s)
          isZIPCode returns true if string s is a valid U.S.
static String stripCharsInBag(String s, String bag)
          Removes all characters which appear in string bag from string s.
static String stripCharsNotInBag(String s, String bag)
          Removes all characters which do NOT appear in string bag from string s.
static String stripInitialWhitespace(String s)
          Removes initial(leading) whitespace characters from s.
static String stripWhitespace(String s)
          Removes all whitespace characters from s.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

defaultEmptyOK

public static final boolean defaultEmptyOK
boolean specifying by default whether or not it is okay for a String to be empty

另请参见:
常量字段值

digits

public static final String digits
digit characters

另请参见:
常量字段值

lowercaseLetters

public static final String lowercaseLetters
lower-case letter characters

另请参见:
常量字段值

uppercaseLetters

public static final String uppercaseLetters
upper-case letter characters

另请参见:
常量字段值

letters

public static final String letters
letter characters

另请参见:
常量字段值

whitespace

public static final String whitespace
whitespace characters

另请参见:
常量字段值

decimalPointDelimiter

public static final String decimalPointDelimiter
decimal point character differs by language and culture

另请参见:
常量字段值

phoneNumberDelimiters

public static final String phoneNumberDelimiters
non-digit characters which are allowed in phone numbers

另请参见:
常量字段值

validUSPhoneChars

public static final String validUSPhoneChars
characters which are allowed in US phone numbers

另请参见:
常量字段值

validWorldPhoneChars

public static final String validWorldPhoneChars
characters which are allowed in international phone numbers(a leading + is OK)

另请参见:
常量字段值

SSNDelimiters

public static final String SSNDelimiters
non-digit characters which are allowed in Social Security Numbers

另请参见:
常量字段值

validSSNChars

public static final String validSSNChars
characters which are allowed in Social Security Numbers

另请参见:
常量字段值

digitsInSocialSecurityNumber

public static final int digitsInSocialSecurityNumber
U.S. Social Security Numbers have 9 digits. They are formatted as 123-45-6789.

另请参见:
常量字段值

digitsInUSPhoneNumber

public static final int digitsInUSPhoneNumber
U.S. phone numbers have 10 digits. They are formatted as 123 456 7890 or(123) 456-7890.

另请参见:
常量字段值

digitsInUSPhoneAreaCode

public static final int digitsInUSPhoneAreaCode
另请参见:
常量字段值

digitsInUSPhoneMainNumber

public static final int digitsInUSPhoneMainNumber
另请参见:
常量字段值

ZipCodeDelimiters

public static final String ZipCodeDelimiters
non-digit characters which are allowed in ZIP Codes

另请参见:
常量字段值

ZipCodeDelimeter

public static final String ZipCodeDelimeter
our preferred delimiter for reformatting ZIP Codes

另请参见:
常量字段值

validZipCodeChars

public static final String validZipCodeChars
characters which are allowed in Social Security Numbers

另请参见:
常量字段值

digitsInZipCode1

public static final int digitsInZipCode1
U.S. ZIP codes have 5 or 9 digits. They are formatted as 12345 or 12345-6789.

另请参见:
常量字段值

digitsInZipCode2

public static final int digitsInZipCode2
U.S. ZIP codes have 5 or 9 digits. They are formatted as 12345 or 12345-6789.

另请参见:
常量字段值

creditCardDelimiters

public static final String creditCardDelimiters
non-digit characters which are allowed in credit card numbers

另请参见:
常量字段值

isNotEmptyMsg

public static final String isNotEmptyMsg
另请参见:
常量字段值

isStateCodeMsg

public static final String isStateCodeMsg
另请参见:
常量字段值

isContiguousStateCodeMsg

public static final String isContiguousStateCodeMsg
另请参见:
常量字段值

isZipCodeMsg

public static final String isZipCodeMsg
另请参见:
常量字段值

isUSPhoneMsg

public static final String isUSPhoneMsg
另请参见:
常量字段值

isUSPhoneAreaCodeMsg

public static final String isUSPhoneAreaCodeMsg
另请参见:
常量字段值

isUSPhoneMainNumberMsg

public static final String isUSPhoneMainNumberMsg
另请参见:
常量字段值

isContiguousZipCodeMsg

public static final String isContiguousZipCodeMsg
另请参见:
常量字段值

isInternationalPhoneNumberMsg

public static final String isInternationalPhoneNumberMsg
另请参见:
常量字段值

isSSNMsg

public static final String isSSNMsg
另请参见:
常量字段值

isEmailMsg

public static final String isEmailMsg
另请参见:
常量字段值

isAnyCardMsg

public static final String isAnyCardMsg
另请参见:
常量字段值

isCreditCardPrefixMsg

public static final String isCreditCardPrefixMsg
另请参见:
常量字段值

isCreditCardSuffixMsg

public static final String isCreditCardSuffixMsg
另请参见:
常量字段值

isDayMsg

public static final String isDayMsg
另请参见:
常量字段值

isMonthMsg

public static final String isMonthMsg
另请参见:
常量字段值

isYearMsg

public static final String isYearMsg
另请参见:
常量字段值

isDatePrefixMsg

public static final String isDatePrefixMsg
另请参见:
常量字段值

isDateSuffixMsg

public static final String isDateSuffixMsg
另请参见:
常量字段值

isHourMsg

public static final String isHourMsg
另请参见:
常量字段值

isMinuteMsg

public static final String isMinuteMsg
另请参见:
常量字段值

isSecondMsg

public static final String isSecondMsg
另请参见:
常量字段值

isTimeMsg

public static final String isTimeMsg
另请参见:
常量字段值

isDateMsg

public static final String isDateMsg
另请参见:
常量字段值

isDateAfterToday

public static final String isDateAfterToday
另请参见:
常量字段值

isIntegerMsg

public static final String isIntegerMsg
另请参见:
常量字段值

isSignedIntegerMsg

public static final String isSignedIntegerMsg
另请参见:
常量字段值

isLongMsg

public static final String isLongMsg
另请参见:
常量字段值

isSignedLongMsg

public static final String isSignedLongMsg
另请参见:
常量字段值

isFloatMsg

public static final String isFloatMsg
另请参见:
常量字段值

isSignedFloatMsg

public static final String isSignedFloatMsg
另请参见:
常量字段值

isSignedDoubleMsg

public static final String isSignedDoubleMsg
另请参见:
常量字段值

daysInMonth

public static final int[] daysInMonth
An array of ints representing the number of days in each month of the year. Note: February varies depending on the year


USStateCodeDelimiter

public static final String USStateCodeDelimiter
Delimiter for USStateCodes String

另请参见:
常量字段值

USStateCodes

public static final String USStateCodes
Valid U.S. Postal Codes for states, territories, armed forces, etc. See http://www.usps.gov/ncsc/lookups/abbr_state.txt.

另请参见:
常量字段值

ContiguousUSStateCodes

public static final String ContiguousUSStateCodes
Valid contiguous U.S. postal codes

另请参见:
常量字段值
构造方法详细信息

UtilValidate

public UtilValidate()
方法详细信息

areEqual

public static boolean areEqual(Object obj,
                               Object obj2)

isEmpty

public static boolean isEmpty(String s)
Check whether string s is empty.


isEmpty

public static boolean isEmpty(Collection c)
Check whether collection c is empty.


isNotEmpty

public static boolean isNotEmpty(String s)
Check whether string s is NOT empty.


isNotEmpty

public static boolean isNotEmpty(Collection c)
Check whether collection c is NOT empty.


isWhitespace

public static boolean isWhitespace(String s)
Returns true if string s is empty or whitespace characters only.


stripCharsInBag

public static String stripCharsInBag(String s,
                                     String bag)
Removes all characters which appear in string bag from string s.


stripCharsNotInBag

public static String stripCharsNotInBag(String s,
                                        String bag)
Removes all characters which do NOT appear in string bag from string s.


stripWhitespace

public static String stripWhitespace(String s)
Removes all whitespace characters from s. Member whitespace(see above) defines which characters are considered whitespace.


charInString

public static boolean charInString(char c,
                                   String s)
Returns true if single character c(actually a string) is contained within string s.


stripInitialWhitespace

public static String stripInitialWhitespace(String s)
Removes initial(leading) whitespace characters from s. Member whitespace(see above) defines which characters are considered whitespace.


isLetter

public static boolean isLetter(char c)
Returns true if character c is an English letter (A .. Z, a..z). NOTE: Need i18n version to support European characters. This could be tricky due to different character sets and orderings for various languages and platforms.


isDigit

public static boolean isDigit(char c)
Returns true if character c is a digit (0 .. 9).


isLetterOrDigit

public static boolean isLetterOrDigit(char c)
Returns true if character c is a letter or digit.


isInteger

public static boolean isInteger(String s)
Returns true if all characters in string s are numbers. Accepts non-signed integers only. Does not accept floating point, exponential notation, etc.


isSignedInteger

public static boolean isSignedInteger(String s)
Returns true if all characters are numbers; first character is allowed to be + or - as well. Does not accept floating point, exponential notation, etc.


isSignedLong

public static boolean isSignedLong(String s)
Returns true if all characters are numbers; first character is allowed to be + or - as well. Does not accept floating point, exponential notation, etc.


isPositiveInteger

public static boolean isPositiveInteger(String s)
Returns true if string s is an integer > 0. NOTE: using the Java Long object for greatest precision


isNonnegativeInteger

public static boolean isNonnegativeInteger(String s)
Returns true if string s is an integer >= 0.


isNegativeInteger

public static boolean isNegativeInteger(String s)
Returns true if string s is an integer < 0.


isNonpositiveInteger

public static boolean isNonpositiveInteger(String s)
Returns true if string s is an integer <= 0.


isFloat

public static boolean isFloat(String s)
True if string s is an unsigned floating point(real) number. Also returns true for unsigned integers. If you wish to distinguish between integers and floating point numbers, first call isInteger, then call isFloat. Does not accept exponential notation.


isSignedFloat

public static boolean isSignedFloat(String s)
True if string s is a signed or unsigned floating point (real) number. First character is allowed to be + or -. Also returns true for unsigned integers. If you wish to distinguish between integers and floating point numbers, first call isSignedInteger, then call isSignedFloat.


isSignedDouble

public static boolean isSignedDouble(String s)
True if string s is a signed or unsigned floating point (real) number. First character is allowed to be + or -. Also returns true for unsigned integers. If you wish to distinguish between integers and floating point numbers, first call isSignedInteger, then call isSignedFloat.


isAlphabetic

public static boolean isAlphabetic(String s)
Returns true if string s is letters only. NOTE: This should handle i18n version to support European characters, etc. since it now uses Character.isLetter()


isAlphanumeric

public static boolean isAlphanumeric(String s)
Returns true if string s is English letters (A .. Z, a..z) and numbers only. NOTE: Need i18n version to support European characters. This could be tricky due to different character sets and orderings for various languages and platforms.


isSSN

public static boolean isSSN(String s)
isSSN returns true if string s is a valid U.S. Social Security Number. Must be 9 digits.


isUSPhoneNumber

public static boolean isUSPhoneNumber(String s)
isUSPhoneNumber returns true if string s is a valid U.S. Phone Number. Must be 10 digits.


isUSPhoneAreaCode

public static boolean isUSPhoneAreaCode(String s)
isUSPhoneAreaCode returns true if string s is a valid U.S. Phone Area Code. Must be 3 digits.


isUSPhoneMainNumber

public static boolean isUSPhoneMainNumber(String s)
isUSPhoneMainNumber returns true if string s is a valid U.S. Phone Main Number. Must be 7 digits.


isInternationalPhoneNumber

public static boolean isInternationalPhoneNumber(String s)
isInternationalPhoneNumber returns true if string s is a valid international phone number. Must be digits only; any length OK. May be prefixed by + character.


isZipCode

public static boolean isZipCode(String s)
isZIPCode returns true if string s is a valid U.S. ZIP code. Must be 5 or 9 digits only.


isContiguousZipCode

public static boolean isContiguousZipCode(String s)
Returns true if string s is a valid contiguous U.S. Zip code. Must be 5 or 9 digits only.


isStateCode

public static boolean isStateCode(String s)
Return true if s is a valid U.S. Postal Code (abbreviation for state).


isContiguousStateCode

public static boolean isContiguousStateCode(String s)
Return true if s is a valid contiguous U.S. Postal Code (abbreviation for state).


isEmail

public static boolean isEmail(String s)
Email address must be of form a@b.c -- in other words: - there must be at least one character before the @ - there must be at least one character before and after the . - the characters @ and . are both required


isYear

public static boolean isYear(String s)
isYear returns true if string s is a valid Year number. Must be 2 or 4 digits only. For Year 2000 compliance, you are advised to use 4-digit year numbers everywhere.


isIntegerInRange

public static boolean isIntegerInRange(String s,
                                       int a,
                                       int b)
isIntegerInRange returns true if string s is an integer within the range of integer arguments a and b, inclusive.


isMonth

public static boolean isMonth(String s)
isMonth returns true if string s is a valid month number between 1 and 12.


isDay

public static boolean isDay(String s)
isDay returns true if string s is a valid day number between 1 and 31.


daysInFebruary

public static int daysInFebruary(int year)
Given integer argument year, returns number of days in February of that year.


isHour

public static boolean isHour(String s)
isHour returns true if string s is a valid number between 0 and 23.


isMinute

public static boolean isMinute(String s)
isMinute returns true if string s is a valid number between 0 and 59.


isSecond

public static boolean isSecond(String s)
isSecond returns true if string s is a valid number between 0 and 59.


isDate

public static boolean isDate(String year,
                             String month,
                             String day)
isDate returns true if string arguments year, month, and day form a valid date.


isDate

public static boolean isDate(String date)
isDate returns true if string argument date forms a valid date.


isDateAfterToday

public static boolean isDateAfterToday(String date)
isDate returns true if string argument date forms a valid date and is after today.


isTime

public static boolean isTime(String hour,
                             String minute,
                             String second)
isTime returns true if string arguments hour, minute, and second form a valid time.


isTime

public static boolean isTime(String time)
isTime returns true if string argument time forms a valid time.


isCreditCard

public static boolean isCreditCard(String stPassed)
Checks credit card number with Luhn Mod-10 test

参数:
stPassed - a string representing a credit card number
返回:
true, if the credit card number passes the Luhn Mod-10 test, false otherwise

isVisa

public static boolean isVisa(String cc)
Checks to see if the cc number is a valid Visa number

参数:
cc - a string representing a credit card number; Sample number: 4111 1111 1111 1111(16 digits)
返回:
true, if the credit card number is a valid VISA number, false otherwise

isMasterCard

public static boolean isMasterCard(String cc)
Checks to see if the cc number is a valid Master Card number

参数:
cc - a string representing a credit card number; Sample number: 5500 0000 0000 0004(16 digits)
返回:
true, if the credit card number is a valid MasterCard number, false otherwise

isAmericanExpress

public static boolean isAmericanExpress(String cc)
Checks to see if the cc number is a valid American Express number

参数:
cc - - a string representing a credit card number; Sample number: 340000000000009(15 digits)
返回:
true, if the credit card number is a valid American Express number, false otherwise

isDinersClub

public static boolean isDinersClub(String cc)
Checks to see if the cc number is a valid Diners Club number

参数:
cc - - a string representing a credit card number; Sample number: 30000000000004(14 digits)
返回:
true, if the credit card number is a valid Diner's Club number, false otherwise

isCarteBlanche

public static boolean isCarteBlanche(String cc)
Checks to see if the cc number is a valid Carte Blanche number

参数:
cc - - a string representing a credit card number; Sample number: 30000000000004(14 digits)
返回:
true, if the credit card number is a valid Carte Blanche number, false otherwise

isDiscover

public static boolean isDiscover(String cc)
Checks to see if the cc number is a valid Discover number

参数:
cc - - a string representing a credit card number; Sample number: 6011000000000004(16 digits)
返回:
true, if the credit card number is a valid Discover card number, false otherwise

isEnRoute

public static boolean isEnRoute(String cc)
Checks to see if the cc number is a valid EnRoute number

参数:
cc - - a string representing a credit card number; Sample number: 201400000000009(15 digits)
返回:
true, if the credit card number is a valid enRoute card number, false, otherwise

isJCB

public static boolean isJCB(String cc)
Checks to see if the cc number is a valid JCB number

参数:
cc - - a string representing a credit card number; Sample number: 3088000000000009(16 digits)
返回:
true, if the credit card number is a valid JCB card number, false otherwise

isAnyCard

public static boolean isAnyCard(String ccPassed)
Checks to see if the cc number is a valid number for any accepted credit card

参数:
ccPassed - - a string representing a credit card number
返回:
true, if the credit card number is any valid credit card number for any of the accepted card types, false otherwise

getCardType

public static String getCardType(String ccPassed)
Checks to see if the cc number is a valid number for any accepted credit card, and return the name of that type

参数:
ccPassed - - a string representing a credit card number
返回:
true, if the credit card number is any valid credit card number for any of the accepted card types, false otherwise

isCardMatch

public static boolean isCardMatch(String cardType,
                                  String cardNumberPassed)
Checks to see if the cc number is a valid number for the specified type

参数:
cardType - - a string representing the credit card type
cardNumberPassed - - a string representing a credit card number
返回:
true, if the credit card number is valid for the particular credit card type given in "cardType", false otherwise

isNotPoBox

public static boolean isNotPoBox(String s)
isNotPoBox returns true if address argument does not contain anything that looks like a a PO Box.



Copyright © 2013. All Rights Reserved.