Java tutorial
//package com.java2s; import java.util.HashMap; public class Main { /** * Extract parameters from an uri using parameter name as name * @param uri An uri from which extract parameters * @return The parameters list */ public static HashMap<String, String> getParameters(String uri) { // split each parameter in a string array String parameterString[] = uri.split("&"); HashMap<String, String> params = new HashMap<String, String>(); // store parameter in parameters map // first string if the parameter name, second is the parameter value for (String p : parameterString) { String paramPair[] = p.split("="); params.put(paramPair[0], paramPair[1]); } return params; } }