Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Character Masking  RSS feed

 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Currently I have a requirement like masking the character like

EMPLOYEE details “12MANSIION32”
I want to change it to “12MANXXXXXX32”

I saw in few banks and government sites they did this
Please assist me. How to do this..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You first have to understand the rules you want to apply. What are your requirements ? Is it as simple as "replace 6 characters from the 6th position of the string" ? Or is it something more complicated ? Do you need to do it in Java, or, if you are using a database, can you do it straight from your SQL ?
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Just try out this one

out put : 12MANXXXXX32

I hope that helps.
 
Campbell Ritchie
Marshal
Posts: 55799
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Malatesh Karabisti wrote: . . . I hope that helps.
That is one way to do it, but StringBuilder is probably better than StringBuffer.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!