Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Padding Credit Card Number with XXXX

Status
Not open for further replies.

reyes99

Technical User
Jun 10, 2003
1
US
Hi,

I have a very simple question for you guys. How do I get a credit card number and format it to hide the numbers when I print a report like xxxx-xxxx-xxxx-1234.

I am using foxpro 2.6 for windows.

Thanks

reyes99
 
As to the "How do I get a credit card number" question, that depends on a lot of other variables:
* Is the number being manually entered by a cash register operator?
* Is the number to be automatically read in via some attached credit card reader?
* How?
We need more information to help you on this one.

However, as to how do you change its format for printing, that one is easy.

You originally have a number such as:
m.cCredCrdNo = "6789-4567-1212-1234"
m.cRightFour = RIGHT(m.cCredCrdNo, 4) && "1234"
m.cPrntCredCrdNo = "xxxx-xxxx-xxxx-" + m.cRightFour

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
I use this as the report field expression:

LEFT(cardnumber,4)+REPL('*',LEN(ALLTRIM(cardnumber))-8)+RIGHT(ALLTRIM(cardnumber),4)

This prints the first 4 and last 4 digits of the credit card number, regardless of the type of card. You can change it to fit your needs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top