> Does anyone have a method using MapBasic to test whether a string is
> numeric? I have a dialog with an edittext box that needs a numeric
> input. Even if the solution is just a big hack that would be OK, since
> I am going to make a logical MB function along the lines of
> IsNumeric("123") = TRUE or something.
Here's a hack...
function IsNumeric (byval sVal as string) as logical
dim i as integer
for i = 1 to Len(sVal)
if InStr (1, mid$(sVal,i,1), " 0123456789.+-e")) = 0 then
'Found a non-numeric character; string is not numeric
exit function
end if
next
IsNumeric = 1
end function
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11755