mask cc number in log files from a string in the log file
lina ajay
Ranch Hand
Joined: Apr 04, 2008
Posts: 31
posted
0
hi
issue :--
i want to mask the creditcard number which gets displayed in my log files .
i have a class for creditcard processing which gets the information abt creditcard and writes it to a log file - i have to find the position of the cc in the long string" transaction string" which has details abt user id etc too.
this is what i have done so far
int logtranString = transactionString.indexOf("cc");
can anyone please help me in accomplishing the rest of it.
This may be a good place to use RegEx with the String.replaceAll(regex, replacement) method.
Look into the Pattern API and see if you can't find a Pattern that would match:
"4 digits" dash "4 digits" dash "4 digits" dash "4 digits" coming after "cc"
If you aren't familiar with RegEx then your strategy may be:
By four characters, Rob, you presumably mean four digits?
lina ajay
Ranch Hand
Joined: Apr 04, 2008
Posts: 31
posted
0
when i use StringBuilder SB= new String Builder(); I am getting an error message that -- string builder not defined. i have imported java.util.*; is there any other class to be imported to use this.
jvm on my machine is 1.5 version.
thanks
Steve Luke wrote:This may be a good place to use RegEx with the String.replaceAll(regex, replacement) method.
Look into the Pattern API and see if you can't find a Pattern that would match:
"4 digits" dash "4 digits" dash "4 digits" dash "4 digits" coming after "cc"
If you aren't familiar with RegEx then your strategy may be: