最近领导要求i通过p解析确定城市,比较简单,难点是通过大学名称来确定城市 下面是代码:
代码需要用到 全国高校数据库
package com.dianyou.ip; import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils; import java.sql.*; /** * Created by Administrator on 2017/12/11. */ public class Location { private String country; private String province; private String city; public Location() { } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public Location getLocation(String ipLocation) { if (ipLocation != null && !"".equals(ipLocation.trim())) { Location location = new Location(); locati