Reputation: 2052
How can I get a parse String of city name without whitespaces (on the start and at the end) and with "%20" instead of " " (which contains some city names) in android.
For example I would like to parse:
" Oklahoma " -> "Oklahoma"
or
" Oklahoma City" -> "Oklahoma%20City"
Upvotes: 0
Views: 112
Reputation: 1963
Uri.encode(" Oklahoma City".trim())
Output :
Oklahoma%20%City
Upvotes: 1