This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "need help" Watch "need help" New topic
Author

need help

Anil Kumar Saha
Ranch Hand

Joined: Apr 07, 2004
Posts: 111
Hi,

I want to delete all the comma(,) and dot(.) from a string. That is if the input is "1,236,4as4.00" I want the output to be "12364as400". Any help will be highly appreciated.


Regards,

Anil Kumar Saha
SCJP 1.4
http://www.agilej.blogspot.com/
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
Something like String.replaceAll("[,\\.]\+", "") should do the trick.


Ping & DNS - updated with new look and Ping home screen widget
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

You can use the method String.replaceAll() for this. Note that the argument to the method is a regular expression.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Anil Kumar Saha
Ranch Hand

Joined: Apr 07, 2004
Posts: 111
Ulf Dittmer/Jesper Young,

Thanks a lot for your quick help.It is working.
I need to brush up on regular expressions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help
 
Similar Threads
Outgrowing our server(s)!
how can I runc++ pro in java?
how to dispaly the selected value of a dropdown list
Help
How do i create sub domain using JSP