标签:
public static void main(String[] args) { String url = "http://localhost/DTKCPTSWJ/NewsDetail.aspx?PID=9&ClassID=19&NewsID=115"; String[] parameters = { "ClassID", "NewsID" }; String u; try { u = URLDecoder.decode(url, "UTF-8"); for (String s : parameters) { String[] a = new String[2]; if (u.indexOf(s) != -1) { a = (u.substring(u.indexOf(s))).split("&"); a[0].split("="); } System.out.println(a[0]); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
标签:
原文地址:http://www.cnblogs.com/leichentao0905/p/4444998.html