How to format decimals in Thymeleaf without unnecessary zeros

Viewed 813

I have a problem with decimals in Thymeleaf. In my app I store the amount of coins in a variable of type Double and when I try to render it in thymeleaf view I receive scientific notation.

In the Thymeleaf documentation I found a method called formatDecimal but in my case it doesn't work as I want to.

EXAMPLE:

In my Thymeleaf template:

<td th:text="${#numbers.formatDecimal(coin.getAmountOfCoin(), 1, 8)}">

In browser:

Results

Is there any possibility to remove unnecessary zeros?

0 Answers
Related