isValidCreditCard

Validates a credit-card number using luhn's algorithm.

bool
isValidCreditCard
(,
size_t[] allowedDigits = null
)

Parameters

creditCardNumber string

The number of the credit card.

allowedDigits size_t[]

The allowed length of digits. If it's null it allows credit card numbers to be any length.

Return Value

Type: bool

True if the credit card number is valid according to the allowed digits and luhn's algorithm, false otherwise.

Meta