Okay, so ive got a long string, and I want to remove everything thats inside, except for decimal numbers, comma's and dots,
I have tried:
str = str.replace("[^0-9\\.\\,]","");
But this just ends up in nothing..
Can anyone help me?
Thanks!
You don't need to escape the characters in the character group. You should also be using replaceAll()
.
str = str.replaceAll("[^0-9.,]+","");
Try str.replaceAll("[^0-9.,]+","");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With