• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Removing ^M Characters in Java

 
Biju Philip
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic