Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a command to know if a value is numeric or char
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00208000
Message ID:
00208019
Views:
26
>>To check if a string is a valid numeric, ALLTRIM() the variable and then test each remaining character to see if it's in the valid character set ('0123456789.' for a decimal number).
>
>...using EMPTY(CHRTRAN(string,"1234567890. -",""))
>

Nice, but we still have to check to make sure that only one "." appears, and that "-" only appears as a prefix (unless the field can contain numeric expressions, in which case, all bets are off.) I'll steal this snippet if you don't mind - it's quicker that what I do now.

>Christof
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform