Java解析省市县树形结构工具类

Posted 程序媛一枚~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java解析省市县树形结构工具类相关的知识,希望对你有一定的参考价值。

这篇博客将介绍如何根据6位行政编码,解析出省市县区等。adcode共6位,前俩位省/直辖市/自治区,前4位城市,6位区县,并优雅的树形结构输出省市。

本文只解析了俩层,感兴趣的小伙伴可以自行解析区县。

1.效果图


优雅的树形结构输出省市:

22:30:51.617 [main] INFO TestCityProvinceMap - map: 34 370000=Province(proadcode=370000, name=山东省, cities=[City(citycode=370100, name=济南市), City(citycode=370200, name=青岛市), City(citycode=370300, name=淄博市), City(citycode=370400, name=枣庄市), City(citycode=370500, name=东营市), City(citycode=370600, name=烟台市), City(citycode=370700, name=潍坊市), City(citycode=370800, name=济宁市), City(citycode=370900, name=泰安市), City(citycode=371000, name=威海市), City(citycode=371100, name=日照市), City(citycode=371300, name=临沂市), City(citycode=371400, name=德州市), City(citycode=371500, name=聊城市), City(citycode=371600, name=滨州市), City(citycode=371700, name=菏泽市)]), 620000=Province(proadcode=620000, name=甘肃省, cities=[City(citycode=620100, name=兰州市), City(citycode=620200, name=嘉峪关市), City(citycode=620300, name=金昌市), City(citycode=620400, name=白银市), City(citycode=620500, name=天水市), City(citycode=620600, name=武威市), City(citycode=620700, name=张掖市), City(citycode=620800, name=平凉市), City(citycode=620900, name=酒泉市), City(citycode=621000, name=庆阳市), City(citycode=621100, name=定西市), City(citycode=621200, name=陇南市), City(citycode=622900, name=临夏回族自治州), City(citycode=623000, name=甘南藏族自治州)]), 320000=Province(proadcode=320000, name=江苏省, cities=[City(citycode=320100, name=南京市), City(citycode=320200, name=无锡市), City(citycode=320300, name=徐州市), City(citycode=320400, name=常州市), City(citycode=320500, name=苏州市), City(citycode=320600, name=南通市), City(citycode=320700, name=连云港市), City(citycode=320800, name=淮安市), City(citycode=320900, name=盐城市), City(citycode=321000, name=扬州市), City(citycode=321100, name=镇江市), City(citycode=321200, name=泰州市), City(citycode=321300, name=宿迁市)]), 110000=Province(proadcode=110000, name=北京市, cities=[City(citycode=110000, name=北京市)]), 530000=Province(proadcode=530000, name=云南省, cities=[City(citycode=530100, name=昆明市), City(citycode=530300, name=曲靖市), City(citycode=530400, name=玉溪市), City(citycode=530500, name=保山市), City(citycode=530600, name=昭通市), City(citycode=530700, name=丽江市), City(citycode=530800, name=普洱市), City(citycode=530900, name=临沧市), City(citycode=532300, name=楚雄彝族自治州), City(citycode=532500, name=红河哈尼族彝族自治州), City(citycode=532600, name=文山壮族苗族自治州), City(citycode=532800, name=西双版纳傣族自治州), City(citycode=532900, name=大理白族自治州), City(citycode=533100, name=德宏傣族景颇族自治州), City(citycode=533300, name=怒江傈僳族自治州), City(citycode=533400, name=迪庆藏族自治州)]), 460000=Province(proadcode=460000, name=海南省, cities=[City(citycode=460100, name=海口市), City(citycode=460200, name=三亚市), City(citycode=460300, name=三沙市), City(citycode=460400, name=儋州市)]), 330000=Province(proadcode=330000, name=浙江省, cities=[City(citycode=330100, name=杭州市), City(citycode=330200, name=宁波市), City(citycode=330300, name=温州市), City(citycode=330400, name=嘉兴市), City(citycode=330500, name=湖州市), City(citycode=330600, name=绍兴市), City(citycode=330700, name=金华市), City(citycode=330800, name=衢州市), City(citycode=330900, name=舟山市), City(citycode=331000, name=台州市), City(citycode=331100, name=丽水市)]), 310000=Province(proadcode=310000, name=上海市, cities=[City(citycode=310000, name=上海市)]), 120000=Province(proadcode=120000, name=天津市, cities=[City(citycode=120000, name=天津市)]), 610000=Province(proadcode=610000, name=陕西省, cities=[City(citycode=610100, name=西安市), City(citycode=610200, name=铜川市), City(citycode=610300, name=宝鸡市), City(citycode=610400, name=咸阳市), City(citycode=610500, name=渭南市), City(citycode=610600, name=延安市), City(citycode=610700, name=汉中市), City(citycode=610800, name=榆林市), City(citycode=610900, name=安康市), City(citycode=611000, name=商洛市)]), 650000=Province(proadcode=650000, name=新疆维吾尔自治区, cities=[City(citycode=650100, name=乌鲁木齐市), City(citycode=650200, name=克拉玛依市), City(citycode=650400, name=吐鲁番市), City(citycode=650500, name=哈密市), City(citycode=652300, name=昌吉回族自治州), City(citycode=652700, name=博尔塔拉蒙古自治州), City(citycode=652800, name=巴音郭楞蒙古自治州), City(citycode=652900, name=阿克苏地区), City(citycode=653000, name=克孜勒苏柯尔克孜自治州), City(citycode=653100, name=喀什地区), City(citycode=653200, name=和田地区), City(citycode=654000, name=伊犁哈萨克自治州), City(citycode=654200, name=塔城地区), City(citycode=654300, name=阿勒泰地区)]), 520000=Province(proadcode=520000, name=贵州省, cities=[City(citycode=520100, name=贵阳市), City(citycode=520200, name=六盘水市), City(citycode=520300, name=遵义市), City(citycode=520400, name=安顺市), City(citycode=520500, name=毕节市), City(citycode=520600, name=铜仁市), City(citycode=522300, name=黔西南布依族苗族自治州), City(citycode=522600, name=黔东南苗族侗族自治州), City(citycode=522700, name=黔南布依族苗族自治州)]), 340000=Province(proadcode=340000, name=安徽省, cities=[City(citycode=340100, name=合肥市), City(citycode=340200, name=芜湖市), City(citycode=340300, name=蚌埠市), City(citycode=340400, name=淮南市), City(citycode=340500, name=马鞍山市), City(citycode=340600, name=淮北市), City(citycode=340700, name=铜陵市), City(citycode=340800, name=安庆市), City(citycode=341000, name=黄山市), City(citycode=341100, name=滁州市), City(citycode=341200, name=阜阳市), City(citycode=341300, name=宿州市), City(citycode=341500, name=六安市), City(citycode=341600, name=亳州市), City(citycode=341700, name=池州市), City(citycode=341800, name=宣城市)]), 820000=Province(proadcode=820000, name=澳门特别行政区, cities=[City(citycode=820000, name=澳门特别行政区)]), 430000=Province(proadcode=430000, name=湖南省, cities=[City(citycode=430100, name=长沙市), City(citycode=430200, name=株洲市), City(citycode=430300, name=湘潭市), City(citycode=430400, name=衡阳市), City(citycode=430500, name=邵阳市), City(citycode=430600, name=岳阳市), City(citycode=430700, name=常德市), City(citycode=430800, name=张家界市), City(citycode=430900, name=益阳市), City(citycode=431000, name=郴州市), City(citycode=431100, name=永州市), City(citycode=431200, name=怀化市), City(citycode=431300, name=娄底市), City(citycode=433100, name=湘西土家族苗族自治州)]), 130000=Province(proadcode=130000, name=河北省, cities=[City(citycode=130100, name=石家庄市), City(citycode=130200, name=唐山市), City(citycode=130300, name=秦皇岛市), City(citycode=130400, name=邯郸市), City(citycode=130500, name=邢台市), City(citycode=130600, name=保定市), City(citycode=130700, name=张家口市), City(citycode=130800, name=承德市), City(citycode=130900, name=沧州市), City(citycode=131000, name=廊坊市), City(citycode=131100, name=衡水市)]), 810000=Province(proadcode=810000, name=香港特别行政区, cities=[City(citycode=810000, name=香港特别行政区)]), 210000=Province(proadcode=210000, name=辽宁省, cities=[City(citycode=210100, name=沈阳市), City(citycode=210200, name=大连市), City(citycode=210300, name=鞍山市), City(citycode=210400, name=抚顺市), City(citycode=210500, name=本溪市), City(citycode=210600, name=丹东市), City(citycode=210700, name=锦州市), City(citycode=210800, name=营口市), City(citycode=210900, name=阜新市), City(citycode=211000, name=辽阳市), City(citycode=211100, name=盘锦市), City(citycode=211200, name=铁岭市), City(citycode=211300, name=朝阳市), City(citycode=211400, name=葫芦岛市)]), 510000=Province(proadcode=510000, name=四川省, cities=[City(citycode=510100, name=成都市), City(citycode=510300, name=自贡市), City(citycode=510400, name=攀枝花市), City(citycode=510500, name=泸州市), City(citycode=510600, name=德阳市), City(citycode=510700, name=绵阳市), City(citycode=510800, name=广元市), City(citycode=510900, name=遂宁市), City(citycode=511000, name=内江市), City(citycode=511100, name=乐山市), City(citycode=511300, name=南充市), City(citycode=511400, name=眉山市), City(citycode=511500, name=宜宾市), City(citycode=511600, name=广安市), City(citycode=511700, name=达州市), City(citycode=511800, name=雅安市), City(citycode=511900, name=巴中市), City(citycode=512000, name=资阳市), City(citycode=513200, name=阿坝藏族羌族自治州), City(citycode=513300, name=甘孜藏族自治州), City(citycode=513400, name=凉山彝族自治州)]), 640000=Province(proadcode=640000, name=宁夏回族自治区, cities=[City(citycode=640100, name=银川市), City(citycode=640200, name=石嘴山市), City地址截取省市县(正则表达式)

php 正则匹配省市区

excel 地址提取省市县

excel 地址提取省市县

中国行政区域

我国的行政区划划分