
Mask all the credit card number digits with asterisks except the last 4, for security purposes. The function works for all types of cards (Visa, MasterCard, Amex, Discovery, etc.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def HideCCDigits(CardNum) | |
CardNum.sub((part = CardNum[0..-5]), '*' * part.length) | |
end |
No comments:
Post a Comment