• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rtrim function in jdk 1.4

 
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
Pie
Posts: 20661
65
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
Marshal
Pie
Posts: 21497
84
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