Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

masked a String

 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21504
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic