Solved

Replacing the text from string

Posted on 2007-03-28
3
183 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exception after setting jdbc session management 2 52
Requested array size exceeds VM limit 3 84
how do i compare an object based on two fields 6 49
difference of if loops 23 42
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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now