隐藏手机号码
private String hidePhone(String pPhone){
String phone = null;
char[] tmp = pPhone.toCharArray();
for(int i=0; i<tmp.length;i++){
if(i>2 && i<7){
tmp[i] = '*';
}
}
phone = String.valueOf(tmp);
return phone ;
}
隐藏真实姓名
private String hideName(String pName){
String name =null;
char[] tmp = pName.toCharArray();
if(tmp.length == 1){
name = pName;
}
if(tmp.length == 2){
name = pName.replaceFirst(pName.substring(1),"*");
}
if(tmp.length > 2){
name = pName.replaceFirst(pName.substring(1,tmp.length-1) ,"*");
}
return name ;
}