String strFCKeditor1 = request.开发者_Python百科getParameter("FCKeditor1");
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.
strFCKeditor1.replaceAll("\n","");//this will replace all \n with blank string
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
精彩评论