首页 > 代码库 > 根据身份证前2位判断属于哪个省

根据身份证前2位判断属于哪个省

package com.sycx.domain;

public class ProByIDcard {
    
    public static String GetPro(String word){
        String pro = "错误身份证号";
        if(word.equals("11")){
            pro = "北京市";
        }else if(word.equals("12")){
            pro = "天津市";
        }else if(word.equals("13")){
            pro = "河北省";
        }else if(word.equals("14")){
            pro = "山西省";
        }else if(word.equals("15")){
            pro = "内蒙古自治区";
        }else if(word.equals("21")){
            pro = "辽宁省";
        }else if(word.equals("22")){
            pro = "吉林省";
        }else if(word.equals("23")){
            pro = "黑龙江省";
        }else if(word.equals("31")){
            pro = "上海市";
        }else if(word.equals("32")){
            pro = "江苏省";
        }else if(word.equals("33")){
            pro = "浙江省";
        }else if(word.equals("34")){
            pro = "安徽省";
        }else if(word.equals("35")){
            pro = "福建省";
        }else if(word.equals("36")){
            pro = "江西省";
        }else if(word.equals("37")){
            pro = "山东省";
        }else if(word.equals("41")){
            pro = "河南省";
        }else if(word.equals("42")){
            pro = "湖北省";
        }else if(word.equals("43")){
            pro = "湖南省";
        }else if(word.equals("44")){
            pro = "广东省";
        }else if(word.equals("45")){
            pro = "广西壮族自治区";
        }else if(word.equals("46")){
            pro = "海南省";
        }else if(word.equals("50")){
            pro = "重庆市";
        }else if(word.equals("51")){
            pro = "四川省";
        }else if(word.equals("52")){
            pro = "贵州省";
        }else if(word.equals("53")){
            pro = "云南省";
        }else if(word.equals("54")){
            pro = "西藏自治区";
        }else if(word.equals("61")){
            pro = "陕西省";
        }else if(word.equals("62")){
            pro = "甘肃省";
        }else if(word.equals("63")){
            pro = "青海省";
        }else if(word.equals("64")){
            pro = "宁夏回族自治区";
        }else if(word.equals("65")){
            pro = "新疆维吾尔自治区";
        }else if(word.equals("71")){
            pro = "台湾省 ";
        }else if(word.equals("81")){
            pro = "香港特别行政区";
        }else if(word.equals("66")){
            pro = "新疆兵团";
        }else if(word.equals("91")){
            pro = "澳门特别行政区";
        }
        
        return pro;
        
    }
}

 

根据身份证前2位判断属于哪个省