File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help

 
Anil Kumar Saha
Ranch Hand
Posts: 111
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like String.replaceAll("[,\\.]\+", "") should do the trick.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the method String.replaceAll() for this. Note that the argument to the method is a regular expression.
 
Anil Kumar Saha
Ranch Hand
Posts: 111
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer/Jesper Young,

Thanks a lot for your quick help.It is working.
I need to brush up on regular expressions.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic