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.)
1. def HideCCDigits(CardNum)
2. CardNum.sub((part = CardNum[0..-5]), '*' * part.length)
3. end