格式化数字,不包括尾随零 [英] Formatting numbers, excluding trailing zeroes
本文介绍了格式化数字,不包括尾随零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道我可以像这样格式化数字:
format-number($ value,'###,###。00')
不过,我想,如果$值为零,除去点和零点。
因此,
37368 - > 37,368
2.666667 - > 2.66
这可能只使用数字格式(似乎并不喜欢它),或者我必须($)
if(int(value)== value){...}
/ code>
解决方案
号格式($值, '###,###。##')
first time SO user :)
I know that I can format a number like this:
format-number($value, '###,###.00')
But I would like to remove the dot and the zeroes if $value is zero.
So,
37368 -> 37,368
2.666667 -> 2.66
Is this possible using just number formatting (doesn't seem like it) or do I have to do something along the lines of
if (int(value) == value ) {...}
解决方案
format-number($value, '###,###.##')
这篇关于格式化数字,不包括尾随零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文