How do I gracefully convert String
to float
into java?
The strings are with the Brazilian location, that is, the values come with a comma as the decimal separator ("12,345").
I think so ... "ugly" to use
String preco = request.getParameter("preco");
try {
cadastro.setPreco(Float.valueOf(preco.replace(",", ".")));
} catch (Exception e)
{
cadastro.setPreco(0);
}
Can not believe that java has no location ... is there any way?