I have a error when I tried do:
private Double isEmpty(String some) {
LOGGER.info("Se ha llamado a isEmpty, valor: " + some);
Double empty = null;
try {
if (some != null) {
// Reemplazar porque nosotros usamos los . para los miles
if(some.contains(".")) {
some = some.replaceAll(".", "");
}
if(some.contains(",")) {
some = some.replaceAll(",", ".");
}
empty = Double.parseDouble(some);
LOGGER.info("Nuevo valor en isEmpty en Double: " + some);
}
} catch (Exception ex) {
LOGGER.error("*******************");
LOGGER.error("************ Falló la ejecución isEmpty *************");
LOGGER.error(ex.getMessage() + ex);
LOGGER.error(ex.getLocalizedMessage());
LOGGER.error("*******************");
}
return empty;
}
In my country "1.000" this is one thousand, In America is One... Then I replace all the characters for format in English...
For example in my country : "2.035,75€" --> Two thousands thirty five with seventy five ... I can't parse this. I do replace ->
"2035.75" for that Java admit this number. BUT I get error ->
Se ha llamado a isEmpty, valor: 19.425
2018-10-16 ERROR 6197 --- [nio-8090-exec-5] Imp : *******************
2018-10-16 ERROR 6197 --- [nio-8090-exec-5] Imp : ************ Falló la ejecución isEmpty *************
2018-10-16 ERROR 6197 --- [nio-8090-exec-5] Imp : empty Stringjava.lang.NumberFormatException: empty String
2018-10-16 ERROR 6197 --- [nio-8090-exec-5] Imp : empty String
2018-10-16 ERROR 6197 --- [nio-8090-exec-5] Imp : *******************