gpt4 book ai didi

java - 在 thymeleaf 前端中将 int 转换为 float

转载 作者:行者123 更新时间:2023-11-30 02:48:45 26 4
gpt4 key购买 nike

我有这样的东西:

<span th:text="*{a / (b + c)}"></span>

其中 a、b 和 c 是整数。我需要结果是 float 。

有什么想法吗?

实际代码:

<span th:text="(*{item.candidates } > 0 and *{item.budgetSeats + item.taxSeats} > 0)?*{#numbers.formatDecimal(item.candidates / (item.budgetSeats + item.taxSeats),1,2, 'POINT')}:'N/A'">

最佳答案

答案很简单:

将(至少)其中一个数字与 float 相乘,例如1.0

<span th:text="*{ (a * 1.0) / (b + c)}"></span> 

关于java - 在 thymeleaf 前端中将 int 转换为 float,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39350392/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com