This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes RE: Replace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "RE: Replace "\n" with "\\n"???" Watch "RE: Replace "\n" with "\\n"???" New topic
Author

RE: Replace "\n" with "\\n"???

MOGUL77777
Greenhorn

Joined: Apr 03, 2002
Posts: 1
I have a JSP where I am trying to display a string that may or may not have new line characters within it ("\n"). I want to display this string in a textarea on my JSP. What I need to do this is to have a method that will replace all new line characters with "\\n"
Could someone please give me some help in creating this method? I can not seem to get the output I need?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Use a StringTokenizer?
and we appreciate your visit, but "MOGUL77777" is not a valid name according to the JavaRanch naming standards.
Please edit your profile and select a new name which meets the requirements.
ta,
Dave
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RE: Replace "\n" with "\\n"???
 
Similar Threads
Converting String to HTML
String search
Reading and Writing using a Large Random Access File
textarea
Printing document with Javax.Print package problem.