java - How to apply a mask to a String? -


hi have credit card number string. need apply mask hide cc number:

i have "123-123-123" , need "123-xxx-123"

is there elegant way this? i'm trying avoid using severals substring() functions...

thanks in advance

myccstr = myccstr.replacefirst("-[0-9]{3}-", "-xxx-");


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -