This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Strip Characters out of String Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Strip Characters out of String" Watch "Strip Characters out of String" New topic
Author

Strip Characters out of String

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1254
I need help to strip all characters out of a string except numbers and commas's.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 9948
    
    6

What have you tried?


Never ascribe to malice that which can be adequately explained by stupidity.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1254
fred rosenberger wrote:What have you tried?


I have this but it will strip out even the commas

Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 792
    
    2

You've told it not to strip only digits. Would adding comma do the job:


The quieter you are, the more you are able to hear.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1254
Kemal Sokolovic wrote:You've told it not to strip only digits. Would adding comma do the job:


That worked great. Thanks
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 792
    
    2

You're welcome.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Strip Characters out of String
 
Similar Threads
Efficient Way To Remove Non Alphanumerics From A String
Formatting problem
Removing ^M Characters in Java
Is this a valid way to remove control characters: "{cntrl}"
  ...