How to extract parameters from a given url

后端 未结 7 546
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 05:10

In Java I have:

String params = \"depCity=PAR&roomType=D&depCity=NYC\";

I want to get values of depCity parameters (PA

相关标签:
7条回答
  • 2020-11-27 06:10

    If you are developing an Android application, try this:

    String yourParam = null;
     Uri uri = Uri.parse(url);
            try {
                yourParam = URLDecoder.decode(uri.getQueryParameter(PARAM_NAME), "UTF-8");
            } catch (UnsupportedEncodingException exception) {
                exception.printStackTrace();
            }
    
    0 讨论(0)
提交回复
热议问题