Reputation: 345
String strFCKeditor1 = request.getParameter("FCKeditor1");
Upvotes: 0
Views: 14293
Reputation: 8116
String strFCKeditor1 = request.getParameter("FCKeditor1").replaceAll("\\r|\\n", "");
You also need to replace the \r
and/or \n\r
(hence the regex), not just \n
as stated in the other answer, since you don't know whether your user is using Windows / Mac OSX / Linux.
Upvotes: 6
Reputation: 7580
From your question i assume you want to remove the newline characters from the end of your string.
Use -
StringUtils.chomp(str);
http://commons.apache.org/lang/apidocs/src-html/org/apache/commons/lang3/StringUtils.html#line.4353
Upvotes: -2
Reputation: 240870
strFCKeditor1.replaceAll("\n","");//this will replace all \n with blank string
Upvotes: 1