@Test public void defaultHide() { Assert.assertEquals("t*t", SensitiveUtils.defaultHide("ttt")); Assert.assertEquals("123***78", SensitiveUtils.defaultHide("12345678")); }
public String defaultHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int length = tmp.length(); int headNum = (int) Math.ceil(length / 3.0); int tailNum = (int) Math.floor(length / 3.0); return customizeHide(tmp, headNum, tailNum, length - headNum - tailNum); }
SensitiveUtils { public String defaultHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int length = tmp.length(); int headNum = (int) Math.ceil(length / 3.0); int tailNum = (int) Math.floor(length / 3.0); return customizeHide(tmp, headNum, tailNum, length - headNum - tailNum); } }
SensitiveUtils { public String defaultHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int length = tmp.length(); int headNum = (int) Math.ceil(length / 3.0); int tailNum = (int) Math.floor(length / 3.0); return customizeHide(tmp, headNum, tailNum, length - headNum - tailNum); }  }
SensitiveUtils { public String defaultHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int length = tmp.length(); int headNum = (int) Math.ceil(length / 3.0); int tailNum = (int) Math.floor(length / 3.0); return customizeHide(tmp, headNum, tailNum, length - headNum - tailNum); }  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 defaultHide(String data) { if (!Strings.hasText(data)) { return data; } String tmp = data.trim(); int length = tmp.length(); int headNum = (int) Math.ceil(length / 3.0); int tailNum = (int) Math.floor(length / 3.0); return customizeHide(tmp, headNum, tailNum, length - headNum - tailNum); }  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);  }