如何准确地获得一个整数?
程序员文章站
2022-05-03 15:32:22
如何准确地获得一个整数?function numbersonlynodecimals(pinstring)&nb...
如何准确地获得一个整数?
function numbersonlynodecimals(pinstring)
lnumbersonly = ""
for x = 1 to len(pinstring)
y = (len(pinstring)-x+1)
if isnumeric(mid(pinstring, y,1)) then
lnumbersonly = lnumbersonly + mid(pinstring,y,1)
else
if mid(pinstring,y,1) = "." then
lnumbersonly = ""
end if
end if
next
for x = 1 to len(lnumbersonly)
y = len(lnumbersonly) - x + 1
lnumbersonlyforward = lnumbersonlyforward + mid(lnumbersonly,y,1)
next
if lnumbersonlyforward = "" then lnumbersonlyforward = "0"
numbersonlynodecimals = lnumbersonlyforward
end function
上一篇: 如何做一个文本书写器?
下一篇: 如何测试字符串的长度?