Friday, October 5, 2018

Mask credit card number in java


String result;
if (string.length() > 4) {
result = string.replaceAll("(?<=.{4})(\\w)", "*");
} else {
result = string.replaceAll("(\\w)", "*");
}


No comments: