
org.chiknrice.iso.util.PanMask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jen8583 Show documentation
Show all versions of jen8583 Show documentation
A flexible Java ENcoder for ISO-8583 messages
The newest version!
package org.chiknrice.iso.util;
/**
* @author Ian Bondoc
*/
public class PanMask implements Mask {
private static final int FIRST = 6;
private static final int LAST = 4;
@Override
public String apply(Object o) {
String pan = o.toString();
StringBuilder s = new StringBuilder();
int startMasked = FIRST;
int endMasked = pan.length() - LAST;
if (startMasked > endMasked) {
startMasked = 0;
endMasked = pan.length();
}
s.append(pan.substring(0, startMasked));
for (int i = startMasked; i < endMasked; i++) {
s.append('*');
}
s.append(pan.substring(endMasked));
return s.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy