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
From
13/04/1999 17:13:33
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00208000
Message ID:
00208015
Views:
29
>I am looking for a command that would tell me if a variable created with STORE is numeric or character. Does it exists?
>

You canuse the TYPE() (or VARTYPE() in VFP6) function to check the type of a variable - numerics will return 'N', character variables 'C'.

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). If a 0 value is not legal in the field, you can always test the result of VAL(character expression)

>Thanks
>Eric
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