Android sets the middle four digits of the mobile phone number to be invisible

Set the middle four digits to * by substring() method

	/*
    设置手机号中间四位不可见
     */
    private String hidePhone (String phone){
    
    
        if(!TextUtils.isEmpty(phone) && phone.length() ==11) {
    
    
            phone = phone.substring(0,3) +"****" + phone.substring(7,11);
        }
        return phone;

    }

Guess you like

Origin blog.csdn.net/weixin_44696740/article/details/116493279