File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Search and replace \n in string

 
Pat Short
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to remove all \n from a string so that its output on one line. I can do this using the following



however, to improve the code and its portability i was wondering how I could use unicode to do this.


Any ideas.

Thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good idea to think about portability and other operating systems

There is a list of possible line-end characters in the Pattern class; look for "line terminators." You can create a regular expression to match them.

That might be one way to solve your problem.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic