How to convert String to Double using JSP FMT EL

Asked

Viewed 53 times

0

Hello I have a 9.9 string, I would like to convert into 9.9 and double to add

Currently I use it like this:

<c:set var="media" value="0" />
//onde a funcao.valor é uma string 9,9
<c:set var="ontem" value="${ontem + funcao.valor}" />

Thank you in advance

1 answer

0

Resolvi rsrs I used the function: fn:replace

So it was like this:

<c:set var="media" value="0" />
//onde a funcao.valor é uma string 9,9
<c:set var="ontem" value="${ontem + fn:replace(funcao.valor,',','.')}" />

Ai worked out rsrs

  • I don’t know if it’s right, but it worked

  • gave an edited, really had something wrong in the part fn:replace(funcao.valor,',','.') where I had put double quotes (") then switched to single quotes (')

Browser other questions tagged

You are not signed in. Login or sign up in order to post.