aspose file tools
The moose likes Beginning Java and the fly likes rtrim function in jdk 1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "rtrim function in jdk 1.4" Watch "rtrim function in jdk 1.4" New topic
Author

rtrim function in jdk 1.4

sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 177
Hi,

Currently i am using jdk 1.4.
I want to remove new line character and carriage return from the end of the String. Do we have the functionality of rtrim in java?
I dont want to remove any leading spaces.

thanks
sudha
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

There isn't just rtrim, but it's not too hard to do yourself:


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16695
    
  19

I want to remove new line character and carriage return from the end of the String. Do we have the functionality of rtrim in java?


Regex will also work here...



And this is the equivalent of Rob's solution...



Henry

Note: code not tested


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: rtrim function in jdk 1.4
 
Similar Threads
initialising in arrys in form bean
JDBC with Oracle prob URGENT
upgrade jdk to 5.0 in WSAD 5.1
What is the Difference between JDK 1.4, JDK 1.5 and JDK 1.6 ?
The problem of JDK and WEBLOGIC