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

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

Java - Returning an array from a method to main -