欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

如何准确地获得一个整数?

程序员文章站 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