How do I remove the non-numeric character from a string in java?

Viewed 118475

I have a long string. What is the regular expression to split the numbers into the array?

10 Answers

Previous answers will strip your decimal point. If you want to save your decimal, you might want to

String str = "My values are : 900.00, 700.00, 650.50";

String[] values = str.split("[^\\d.?\\d]"); 
// split on wherever they are not digits except the '.' decimal point
// values: { "900.00", "700.00", "650.50"}  
Related