@Test public void emailHide() { Assert.assertEquals("835***@163.com", SensitiveUtils.emailHide("835358@163.com")); Assert.assertEquals("83***@163.com", SensitiveUtils.emailHide("83@163.com")); }
public String emailHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int atPos = tmp.indexOf(Strings.AT); if (atPos == -1) { return defaultHide(data); } int frontNum = Math.min(atPos, 3); return customizeHide(tmp, frontNum, tmp.length() - atPos, 3); }
SensitiveUtils { public String emailHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int atPos = tmp.indexOf(Strings.AT); if (atPos == -1) { return defaultHide(data); } int frontNum = Math.min(atPos, 3); return customizeHide(tmp, frontNum, tmp.length() - atPos, 3); } }
SensitiveUtils { public String emailHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int atPos = tmp.indexOf(Strings.AT); if (atPos == -1) { return defaultHide(data); } int frontNum = Math.min(atPos, 3); return customizeHide(tmp, frontNum, tmp.length() - atPos, 3); }  }
SensitiveUtils { public String emailHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int atPos = tmp.indexOf(Strings.AT); if (atPos == -1) { return defaultHide(data); } int frontNum = Math.min(atPos, 3); return customizeHide(tmp, frontNum, tmp.length() - atPos, 3); }  String nameHide(final String data); String idCardNoHide(String data); String bankCardNoHide(String data); String cellphoneHide(String data); String emailHide(String data); String defaultHide(String data); String customizeHide(String data, int front, int tail, int hidden); }
SensitiveUtils { public String emailHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int atPos = tmp.indexOf(Strings.AT); if (atPos == -1) { return defaultHide(data); } int frontNum = Math.min(atPos, 3); return customizeHide(tmp, frontNum, tmp.length() - atPos, 3); }  String nameHide(final String data); String idCardNoHide(String data); String bankCardNoHide(String data); String cellphoneHide(String data); String emailHide(String data); String defaultHide(String data); String customizeHide(String data, int front, int tail, int hidden);  }