Suppose I'm supplied with a String which is like "$123,456,56.25" or "123'456.67" or something similar to this (with digits and a decimal point and some seperator like , or ' or something else which is not predictable). I need to write a method which takes an argument like the one above and returns a String like "12345656.25" or "123456.67" respectively.
Could you please suggest the most efficient and readable code to achieve this?
Note: I'm aware of going through each indexes and checking for whether its retunrs true for Character.isDigit(charAtInedx) or if(charAtInedx == '.')
I'm looking for a more optimized solution both in terms of efficiency and readability
Thanks.