首页 > 其他 > 详细

根据身份证号获取地址

时间:2015-11-16 19:13:20      阅读:266      评论:0      收藏:0      [点我收藏+]
private static String getCurrName(String provinceId) {
		try {
			LineNumberReader lnr = new LineNumberReader(
					new InputStreamReader(DataPrepareUtil.class
							.getResourceAsStream("/idcard_address.txt"), "GBK"));
			String line = lnr.readLine();
			while (line != null) {
				String[] str = line.replace("  ", "").split(" ");
				int code = Integer.parseInt(StringUtils.trim(str[0]));
				if (provinceId.length() == 2
						&& Integer.parseInt(provinceId) * 10000 == code) {
					return StringUtils.trim(str[1]);

				}
				if (provinceId.length() == 4
						&& Integer.parseInt(provinceId) * 100 == code) {
					return StringUtils.trim(str[1]);
				}
				if (provinceId.length() == 6
						&& Integer.parseInt(provinceId) == code) {
					return StringUtils.trim(str[1]);
				}

				line = lnr.readLine();
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		}
		return null;
	}

  

根据身份证号获取地址

原文:http://www.cnblogs.com/anni6/p/4969420.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!