Scala——身份证号码查询籍贯
object Test_身份证查询籍贯 {
def main(args: Array[String]): Unit = {
val code = "42005200210030051".substring(0,2)
println(code)
//判断42是哪个省的
//湖北
// if(code == "42"){
// println("42对应省份为:湖北")
// }else if(code =="33"){
// println("浙江")
// }else{
// println()
// }
val province = code match {
case "11" => "北京"
case "12" => "天津"
case "13" => "河北"
case "14" => "山西"
case "15" => "内蒙古"
case "21" => "辽宁"
case "22" => "吉林"
case "23" => "黑龙江"
case "31" => "上海"
case "32" => "上海"
case "33" => "浙江"
case "34" => "安徽"
case "35" => "福建"
case "36" => "江西"
case "37" => "山东"
case "41" => "河南"
case "42" => "湖北"
case "43" => "湖南"
case "44" => "广东"
case "45" => "广西"
case "46" => "海南"
case "50" => "重庆"
case "51" => "四川"
case "52" => "贵州"
case "53" => "云南"
case "54" => "西藏"
case "61" => "陕西"
case "62" => "甘肃"
case "63" => "青海"
case "64" => "宁夏"
case "65" => "新疆"
case "71" => "台湾"
case "81" => "香港"
case "82" => "澳门"
case "91" => "国外"
case "_" => "未知"
}
println(province)
}
}
根据1,2,3,4,5,6,7 --> 对应 的星期的英文: