Android设置手机号中间四位不可见

通过substring()方法设置中间四位为*

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

    }

猜你喜欢

转载自blog.csdn.net/weixin_44696740/article/details/116493279