码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-12-28 11:38:31      阅读:275      评论:0      收藏:0      [点我收藏+]

标签:香港   澳门   str   ret   equal   pac   宁夏   return   江苏省   

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位判断属于哪个省

标签:香港   澳门   str   ret   equal   pac   宁夏   return   江苏省   

原文地址:http://www.cnblogs.com/tnsay/p/6228455.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!