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.
By four characters, Rob, you presumably mean four digits?
Joined: Apr 04, 2008
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.
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: