File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Stripping Out Carriage Returns
Joined: Nov 16, 2004
May 08, 2008 09:51:00
Why would the following code not take out the carriage returns and line feeds?
descptn = rs.getString("descrip").replaceAll("\r\n"," ").trim();
Joined: Apr 14, 2004
May 08, 2008 09:59:00
Are you not asking it to replace only where there is a carriage return followed by a line break (plus I think you will need to escape the regex escape character)?
This does it I think:
[ May 08, 2008: Message edited by: Paul Sturrock ]
Joined: Jan 30, 2000
May 08, 2008 10:10:00
"I'm not back." - Bill Harding,
I agree. Here's the link:
subject: Stripping Out Carriage Returns
Stripping Carriage Returns
Clear Windows Console....
How do I find a text file is Unix or Dos format via Java API?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015