A quick one would be:
Code...
If IsNumeric(x) Then
do something knowing that it is a number
Else
do something else because it isn't a number
End IfMore Code...
Function IsNumeric(ByVal sTestStr as String) As Logical
If Str$(Val(STestStr)) = sTestStr Then
IsNumeric = TRUE
Else
IsNumeric = FALSE
End IfEnd Function
You can muck around with stripping spaces etc, and adding error handling
r
On Thu, 13 May 2004 17:19:48 -0500, Tim.Nuteson <[EMAIL PROTECTED]> wrote:
Listers,
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.
Thanks, will sum.
Tim Nuteson Target
--------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 11747
--
Robert Crossley Agtrix P/L 9 Short St PO Box 63 New Brighton 2483 Far Southern Queensland AUSTRALIA
153.549004 E 28.517344 S
P: 02 6680 1309 F: New Connection M: 0419 718 642 E: [EMAIL PROTECTED] W: www.agtrix.com W: www.wotzhere.com
--------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 11753
