File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes String replacAll is not working 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 » Beginning Java
Bookmark "String replacAll is not working" Watch "String replacAll is not working" New topic

String replacAll is not working

sambasivarao laghuvarapu

Joined: Jun 07, 2007
Posts: 9
Hi All,

I want to replace some string iam using the replaceAll method but it's not giving the proper output.can anyone explain what is the exact functionality of the string replaceAll method.

Ankit Garg

Joined: Aug 03, 2008
Posts: 9291

Please take time to Carefully Choose One Forum when you start a topic. The servlet forum is not the correct forum for this question. I'll move it.

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankit Garg

Joined: Aug 03, 2008
Posts: 9291

it's not giving the proper output

It doesn't work is not enough for anyone to help you. Please Tell The Details. You can read the documentation of String.replaceAll to know what it does...
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
String.replaceAll(...) has no effect on the original String.

String newString = oldString.replaceAll(...);

should work.
I agree. Here's the link:
subject: String replacAll is not working
Similar Threads
having issues replacing strings
String replace
Eliminating new line characters from a string
change a string
remove line feed and carriage return from a string