Solved

Replacing the text from string

Posted on 2007-03-28
3
188 Views
Last Modified: 2010-03-31
Hi,

I am using JDK 1.5

In my string where I have line breaks, when I reload it the line breaks go away

Can I find In my string that there are how many line breaks in the string and can I replace all of my line breaks with the string  


Can someone help me with the small piece of code

Many Thanks
0
Comment
Question by:dinesh_bali
  • 2
3 Comments
 
LVL 10

Expert Comment

by:Jaax
ID: 18806750
Try
String str = "YourString";
str = str.replace("[\n\r\f]", "&#10");
0
 
LVL 10

Accepted Solution

by:
Jaax earned 500 total points
ID: 18806754
Sorry the method should have been replaceAll
0
 

Author Comment

by:dinesh_bali
ID: 18807238
Thanks, I will come back to you
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Jpanels and Jframe 8 33
eclipse apache tomcat admin console 52 97
hibernate example issues from command prompt 10 41
going to wrong jsp page 2 20
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question