CardUtils

object CardUtils

Properties

Link copied to clipboard

The maximum length of a possible card number

Functions

Link copied to clipboard
Link copied to clipboard
fun getPossibleCardBrand(cardNumber: String?, shouldNormalize: Boolean): CardBrand

Get all possible card brands of the card number

Link copied to clipboard

Get space position by spacing pattern of the card brand e.g. spacing pattern 4-4-4-4 is correlated to space position 4-9-14

Link copied to clipboard
fun isValidCardLength(cardNumber: String?, shouldNormalize: Boolean = false): Boolean

Check if card length is valid

Link copied to clipboard
fun isValidCardNumber(cardNumber: String?): Boolean

Check if card number is valid

Link copied to clipboard

Check if number is a valid luhn number

Link copied to clipboard
fun removeSpacesAndHyphens(cardNumberWithSpaces: String?): String?

Remove all spaces and hyphens of the card number