Reputation: 519
I have a String s="&0_o10&";
I am using this string in a webservice call as url. This string is a part of the url.I have dubugged the code , but its taking the string as "0_o10"
instead of "&0_o10&"
.
Please help me .
Upvotes: 2
Views: 76
Reputation: 8718
When dealing with URLs, if they contain anything that isn't a letter or a number, they should be encoded prior to using them.
Use:
String encodedUrl = URLEncoder.encode("&0_o10&", "UTF-8");
should result in something like %260_o10%26
that can be used with the webservice
Upvotes: 2