Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isValidDouble(value as string) as boolean
- dim as byte comma, exponent, sign
- for i as integer = 0 to len(value)-1
- select case as const value[i]
- case 48,49,50,51,52,53,54,55,56,57 ' 0 - 9
- ' do nothing
- case 101: 'e
- exponent += 1
- if (exponent > 1 or i = 0) then
- return false
- end if
- case 46: ' .
- comma += 1
- if (comma > 1 or i = 0) then
- return false
- end if
- case 45: ' -
- sign += 1
- if (sign > 1 or i > 0) then
- return false
- end if
- case else
- return false
- end select
- next
- return true
- end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement