Android は携帯電話番号の中の 4 桁を非表示に設定します

substring() メソッドで真ん中の 4 桁を * に設定します

	/*
    设置手机号中间四位不可见
     */
    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
おすすめ