Reputation: 91175
I have working in Facebook for my app in Android. I have to use the string to pass as a url. But my description value has a lot of spaces and line breaks. I have to rectify while passing that value as url without spaces. But it will poste on the facebook wall with the spaces. Is it possible? Any Idea.
Upvotes: 0
Views: 5443
Reputation: 597096
When generating your URL parameters, use:
paramString = URLEncoder.encode(paramString, "utf-8");
Upvotes: 6
Reputation: 21892
I'm not sure if you're asking how to properly encode the URL so it has no whitespace, or if you want to remove line breaks from a string. If you want to remove line breaks from a string, do this:
yourString.replaceAll("\n", "");
Upvotes: 2