how to replace the \n in java?
I have working in Facebook for my app in Android. I have to use the string to pass as a url. Bu开发者_JAVA技巧t 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.
When generating your URL parameters, use:
paramString = URLEncoder.encode(paramString, "utf-8");
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", "");
精彩评论