速度模板中的数字格式至少2个小数点
我必须格式化给定字符[132233.2453],例如 - > 132,233.2453
当前代码 - > $ number.format(“ ###,###。## 00”,$ value)
似乎工作正常,但对于字符[295] - >它应该是295.00 [小数点后至少2个字符],但即将到295 [没有任何小数点]
I have to format given character [132233.2453] like this -> 132,233.2453
current code -> $number.format("###,###.##00", $value)
which seems to be working fine, but for character [295] -> it should be 295.00 [minimum 2 characters after decimal points] but it is coming 295 [without any decimal points]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以速度,双引号的字符串被插值。在插值字符串中,
##
开始行注释。因此,基本上您的格式为空。另外,小数规范应为
00 ##
,而不是## 00
。因此,尝试:
$ number.format('###,###。00 ##',$ value)
In Velocity, double quoted strings are interpolated. And in an interpolated string,
##
starts a line comment. So basically your formats are empty.Also, the decimal specification should be
00##
and not##00
.So try:
$number.format('###,###.00##', $value)