I have a string which is "R$3.333,33" and I'm trying to parse it to a double value with this method:
public static BigDecimal parse(final String amount, final Locale locale) throws ParseException {
final NumberFormat format = NumberFormat.getCurrencyInstance(locale);
if (format instanceof DecimalFormat) {
((DecimalFormat) format).setParseBigDecimal(true);
}
return (BigDecimal) format.parse(amount.replaceAll("[^\\d.,]", ""));
}
But I'm getting an exception that says:
W/System.err: java.text.ParseException: Unparseable number: "3.333,33" (at offset 8)
And I'm using it like:
Ferramentas.parse(value.getText().toString(), Locale.FRANCE)