Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a command to know if a value is numeric or char
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00208000
Message ID:
00208015
Vues:
27
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform