• Post Reply Bookmark Topic Watch Topic
  • New Topic

need help  RSS feed

 
Ranch Hand
Posts: 111
  • 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.
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like String.replaceAll("[,\\.]\+", "") should do the trick.
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • 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
  • 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
Boost this thread!