62,614
社区成员
发帖
与我相关
我的任务
分享
private static Map<String, String> getHeader(String url) {
Map<String, String> map = new HashMap<String, String>();
int start = url.indexOf("?");
if (start >= 0) {
String str = url.substring(start + 1);
System.out.println(str);
String[] paramsArr = str.split("&");
for (String param : paramsArr) {
String[] temp = param.split("=");
map.put(temp[0], temp[1]);
}
}
return map;
}
// http://www.helloWorld.com?para1=123¶l2=456&hello=world
// output: {hello=world, paral2=456, para1=123}