vb 中如何判断小数点的位数

比如2.365得出3

第1个回答  2007-08-01
s = "3.356"
print "小数点后有" & len(s) - instr(s,".") & "位"本回答被提问者采纳
第2个回答  2007-08-01
CInt(2.365)返回2
Round(2.365)返回2
Format(2.365,"0")返回2
第3个回答  2007-08-01
private function GetDigitCount(anyNumber as double) as integer
GetDigitCount=0
dim strNumber as string
strNumber=cstr(anyNumber)

dim a
on error resume next
a=split(strNumber,".")
GetDigitCount=len(a(1))
end function
相似回答