改进一下asp自带的formatNumber函数
发布时间:2016-12-29 来源:查字典编辑
摘要:asp的formatNumber再处理类似25/5的值时,结果是5.00处理类似28/8的值时,结果是3.50改进一下,去掉没用的0让结果分...
asp的formatNumber再处理类似25/5的值时,结果是5.00处理类似28/8的值时,结果是3.50
改进一下,去掉没用的0让结果分别是5和3.5
复制代码 代码如下:
Functionfm(nb)
IfIsNumeric(nb)Then
Dima
a=FormatNumber(nb,2,-1)
IfRight((a+""),2)=00Then
fm=CLng(a)
Else
fm=FormatNumber(nb,1,-1)
Endif
Else
fm=0
Endif
EndFunction