String str = "$1,234.56"
str.replaceAll("[^//d]", "");
Desired Output:
1234.56
Bit lost on how to say keep the decimal point (.
).
String str = "$1,234.56"
str.replaceAll("[^//d]", "");
Desired Output:
1234.56
Bit lost on how to say keep the decimal point (.
).
You may use:
str = str.replaceAll("[^\\d.]+", "");
[^\\d.]
is negated character class that will match any character except digit or dot.
Added +
to make this bit more efficient.