Created
April 8, 2019 21:43
-
-
Save LenarBad/17312714eb0c0dfd60f8ef5a3950362f to your computer and use it in GitHub Desktop.
Url query to parameter map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Map<String, String> queryToMap(String query) throws UnsupportedEncodingException { | |
Map<String, String> parameters = new HashMap<>(); | |
String[] queryArray = query.split("&"); | |
for (String string : queryArray) { | |
int idx = string.indexOf("="); | |
parameters.put(decode(string.substring(0, idx), "UTF-8"), decode(string.substring(idx + 1), "UTF-8")); | |
} | |
return parameters; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More on lenar.io