Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting text to Numeric and Date fields
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00167407
Message ID:
00167422
Views:
31
>> Can you try and convert it into a temp var and see if it converts?
>
>Michelle,
>
>That's what I am attempting, but VFP will proceed with the conversion and not have a problem. To further illustrate, if in the command window, you enter:
>
>?VAL('ABC')
>
>You get zero. My question is how do I test 'ABC' to see if it is really valid numeric data. Otherwise how do I distinguish between zero and 'ABC'?
>
>Thanks for the suggestion.
>
>Kind Regards,
>
>Mat Kennedy
>Decision Support Technology Inc.

Well, this isn't fast, but it would work... (In theory, anyway)
FOR i = 1 TO LEN(lcString)
   lcChar = SUBSTR(lcString,i,1)
   IF NOT ISDIGIT(lcCHar) AND NOT INLIST(lcChar,"-",".")
      llNumber = .F.
   ENDIF
ENDFOR

IF llNumber
   MESSAGEBOX("It's a number")
ENDIF
My brain is taking a siesta at the moment, so please pardon me if I goofed up there... :)

-Michelle
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform