Java examples for java.net:URL Query
convert Query String To Properties
//package com.java2s; import java.util.Properties; public class Main { public static void main(String[] argv) { String queryString = "&asdf=java2s.com"; System.out.println(convertQueryStringToProperties(queryString)); }//from w w w. j av a 2s.c om public static Properties convertQueryStringToProperties( String queryString) { if (queryString != null) { Properties prop = new Properties(); String[] queryStringArray = queryString.split("&"); for (int i = 0; i < queryStringArray.length; i++) { String[] avp = queryStringArray[i].split("="); if (avp.length == 2) { prop.put(avp[0], avp[1]); } } return prop; } else { return null; } } }