改进一下asp自带的formatNumber函数


asp的formatNumber再处理类似 25/5的值时,结果是 5.00 处理类似 28/8的值时,结果是3.50
改进一下,去掉没用的0 让结果分别是 5和3.5
复制代码 代码如下:

Function fm(nb)
If IsNumeric(nb) Then
Dim a
a=FormatNumber(nb,2,-1)
If Right((a+""),2)=00 Then
fm=CLng(a)
Else
fm=FormatNumber(nb,1,-1)
End if
Else
fm=0
End if
End Function




« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3