Back to project page dw2020.
The source code is released under:
Apache License
If you think the Android project dw2020 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.fivehundredpx.api.auth; /*from w w w. ja v a 2 s. c o m*/ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class HttpParameterUtil { public static String getUrlParamValue(String url, String param) { int ix = url.indexOf('?'); // if (ix != -1) { url = url.substring(ix + 1); } // String[] params = url.split("&"); // for (int i = 0; i < params.length; i++) { if (params[i].startsWith(param + '=')) { return params[i].split("=")[1]; } } // return null; } public static String encode(String value) { String encoded = null; try { encoded = URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException ignore) { } StringBuffer buf = new StringBuffer(encoded.length()); char focus; for (int i = 0; i < encoded.length(); i++) { focus = encoded.charAt(i); if (focus == '*') { buf.append("%2A"); } else if (focus == '+') { buf.append("%20"); } else if (focus == '%' && (i + 1) < encoded.length() && encoded.charAt(i + 1) == '7' && encoded.charAt(i + 2) == 'E') { buf.append('~'); i += 2; } else { buf.append(focus); } } return buf.toString(); } }