aspose file tools*
The moose likes Java in General and the fly likes masked a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "masked a String" Watch "masked a String" New topic
Author

masked a String

Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

Hi Folks,

I have a barcode LYL01016278572011000000012 , Now I want that when I print it on console ,Only last 4 numbers should be shown rest all should be XXX , say for example.. XXXXXXXXXXX1212 in the form of masked ..!!
please advise me how to achieve this..!!

I have an rough idea...



but is there any advanced functionality does new java 6 gives us, or any other way..!! please advise..!!

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18824
    
  40

Saral Saxena wrote:Hi Folks,

I have a barcode LYL01016278572011000000012 , Now I want that when I print it on console ,Only last 4 numbers should be shown rest all should be XXX , say for example.. XXXXXXXXXXX1212 in the form of masked ..!!
please advise me how to achieve this..!!

I have an rough idea...



but is there any advanced functionality does new java 6 gives us, or any other way..!! please advise..!!



BTW, I took a shot at answering this topic, with the code from your other topic...

http://www.coderanch.com/t/572056/java/java/extracting-portion-number-string

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: masked a String