Parsing a currency String in java

Solution 1:

String newStr = oldStr.replaceAll("[^\\d.]+", "")

This will drop any character that is not either a digit or a period

Solution 2:

If you want to handle monetary values correctly, you will want to have a look at the NumberFormat class, specifically for your case NumberFormat.parse(String). The following article also discusses the problems (and solutions) to handling money in Java:

http://www.javapractices.com/topic/TopicAction.do?Id=13

Other related classes include: Currency and of course BigDecimal.