This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Removing ^M Characters in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Removing ^M Characters in Java" Watch "Removing ^M Characters in Java" New topic
Author

Removing ^M Characters in Java

Biju Philip
Greenhorn

Joined: Nov 03, 2001
Posts: 7
Does anyone know how to remove ^M (newline) characters using Java? I know how to do it in vi, but I need a way to strip them out using Java.
Thanks,
Biju
Leslie Chaim
Ranch Hand

Joined: May 22, 2002
Posts: 336
Gee, there are many ways. You can use regex in Java. In fact Java's regex flavor is much richer then vee eyes flavor. You can also mess around with lastIndexOf() or replace() from the String Class.
The simplest thing maybe trim() from the String Class.
[ December 10, 2002: Message edited by: Leslie Chaim ]

Normal is in the eye of the beholder
 
Consider Paul's rocket mass heater.
 
subject: Removing ^M Characters in Java
 
Similar Threads
JFileChooser to save file
problem with myeclipse idw
Problem Whit Special Characters on server side
Convert string?
Urgent: how to remove ^M (newline) characters using Java?