Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function isValidDouble(value as string) as boolean
  2.     dim as byte comma, exponent, sign
  3.     for i as integer = 0 to len(value)-1
  4.         select case as const value[i]
  5.             case  48,49,50,51,52,53,54,55,56,57 ' 0 - 9
  6.                 ' do nothing
  7.             case 101: 'e
  8.                 exponent += 1
  9.                 if (exponent > 1 or i = 0) then
  10.                     return false
  11.                 end if
  12.             case 46: ' .
  13.                 comma += 1
  14.                 if (comma > 1 or i = 0) then
  15.                     return false
  16.                 end if
  17.             case 45: ' -
  18.                 sign += 1
  19.                 if (sign > 1 or i > 0) then
  20.                     return false
  21.                 end if
  22.             case else
  23.                 return false
  24.         end select
  25.     next
  26.     return true
  27. end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement