Java URL encoding of query string parameters

前端 未结 12 988
清歌不尽
清歌不尽 2020-11-21 05:27

Say I have a URL

http://example.com/query?q=

and I have a query entered by the user such as:

random word £500 bank

12条回答
  •  温柔的废话
    2020-11-21 05:52

    In android I would use this code:

    Uri myUI = Uri.parse ("http://example.com/query").buildUpon().appendQueryParameter("q","random word A3500 bank 24").build();
    

    Where Uri is a android.net.Uri

提交回复
热议问题