隐藏手机号身份证号中间的数字
public class StringUtil { /** * 屏蔽身份证号 * @param src * @param find * @return */ public static String screenIdentityCard(String idCard) { String identityCard = ""; identityCard = idCard.replace(idCard.substring(6, 14), "********"); return identityCard; } /** * 屏蔽电话号码 * @param src * @param find * @return */ public static String screenTelephone(String telephone) { String tel = ""; tel = telephone.substring(0, 3)+"****"+telephone.substring(7); return tel; } }
屏蔽手机号身份证号中间的数字,用*号代替