Credit Card Numbers

The Protector stage library includes the following category functions for credit card numbers. You can use these functions only in stages included in the Protector stage library.
CREDIT_CARD:type()
Returns the type of credit card that the number represents: AMERICAN_EXPRESS, MASTERCARD, or VISA.
Return type: String.
For example, when evaluating 5200-1200-3400-5600, this function returns MASTERCARD.
CREDIT_CARD:firstGroup()
Returns the first numeric group of the credit card number.
Return type: String.
For example, when evaluating 5200-1200-3400-5600, this function returns 5200.
CREDIT_CARD:secondGroup()
Returns the second numeric group of the credit card number.
Return type: String.
For example, when evaluating 5200-1200-3400-5600, this function returns 1200.
CREDIT_CARD:thirdGroup()
Returns the third numeric group of the credit card number.
Return type: String.
For example, when evaluating 5200-1200-3400-5600, this function returns 3400. When evaluating 3700-000000-00000, this function returns 00000.
CREDIT_CARD:fourthGroup()
Returns the fourth numeric group of the credit card number. When a credit card number does not include a fourth numeric group - such as American Express numbers, which only have three groups - this function returns an empty string.
To return the last group of all credit card numbers, use CREDIT_CARD:lastPart().
Return type: String.
For example, when evaluating 5200-1200-3400-5600, this function returns 5600. When evaluating 3700-000000-00000, this function returns an empty string.
CREDIT_CARD:lastPart()
Returns the last group of the credit card number. For Mastercard and Visa numbers, returns the last four digits. For American Express numbers, returns the last five digits.
Return type: String.
For example, when evaluating 5200-1200-3400-5600, this function returns 5600. When evaluating 370000000000000, this function returns 00000.
CREDIT_CARD:std()
Returns credit card numbers in their standard digit groups, separated by hyphens.
Return type: String.
For example, when evaluating an American Express number such as 370000000000000, this function returns 3400-000000-00000. When evaluating a Visa number such as 5200000000000000, this function returns 5200-0000-0000-0000.