Here you can find the source of getQueryValues(String input)
public static Map<String, String> getQueryValues(String input)
//package com.java2s; /*/*from w ww .j a v a 2 s.c om*/ * Copyright 2004 - 2012 Cardiff University. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, String> getQueryValues(String input) { Map<String, String> ret = new HashMap<String, String>(); String[] params = input.split("&"); for (String param : params) { try { int eq = param.indexOf("="); if (eq > 0) { String key = param.substring(0, eq); String value = param.substring(eq + 1, param.length()); value = URLDecoder.decode(value, "UTF-8"); ret.put(key, value); } } catch (UnsupportedEncodingException e) { } } return ret; } }