List of utility methods to do URL Parameter Get
HashMap | paserParams(String url) paser Params String params = url.substring(url.indexOf("?") + 1); String[] arr = params.split("&"); HashMap<String, String> maps = new HashMap<String, String>(); for (String s : arr) { maps.put(s.substring(0, s.indexOf("=")), s.substring(s.indexOf("=") + 1)); return maps; ... |
String | getParamValue(String url, String param) get Param Value if ((url == null) || (param == null)) return null; StringBuffer sb = new StringBuffer(); try { String[] arrStr = split(new URL(url).getQuery(), "&"); for (String str : arrStr) { String[] compare = split(str, "="); if (equals(param, compare[0])) { ... |
String | getValueFromQueryString(String url, String key) get Value From Query String int keyStPos = url.indexOf(key + "=") + key.length() + 1; if (keyStPos == -1) { return ""; int keyEnPos = url.indexOf("&", keyStPos); if (keyEnPos == -1) { keyEnPos = url.length(); return url.substring(keyStPos, keyEnPos); |
HashMap | parserURIQuery(String queryText) parser URI Query HashMap<String, String> resultMap = new HashMap<String, String>(); StringBuilder stringBuilder = new StringBuilder(); String key = null; for (int index = 0; index < queryText.length(); index++) { char token = queryText.charAt(index); switch (token) { case '=': key = stringBuilder.toString(); ... |
URL | getQueryUrl(final String url) get Query Url URL queryUrl = null; try { List<NameValuePair> queries = URLEncodedUtils.parse( new URI(url), "UTF-8"); for (NameValuePair pair : queries) { if ("url".equals(pair.getName())) { queryUrl = new URL(pair.getValue()); } catch (Exception e) { e.printStackTrace(); return queryUrl; |
String | queryComponent(String url) Grabs query component only from url. int queryStart = url.indexOf("?"); if (queryStart == -1) return null; return url.substring(queryStart + 1); |