Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Url query to parameter map
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;
}
@LenarBad

This comment has been minimized.

Copy link
Owner Author

LenarBad commented Apr 8, 2019

More on lenar.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.