• Post Reply Bookmark Topic Watch Topic
  • New Topic

rtrim function in jdk 1.4  RSS feed

 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't just rtrim, but it's not too hard to do yourself:
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!