Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Integer or Real
Message
De
14/11/2012 12:29:13
 
 
À
14/11/2012 08:55:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01557140
Message ID:
01557182
Vues:
59
>Hi
>
>What's the easiest way, programmatically in code, to determine if a variable/field is a real or integer? I have code, which loops through fields in a database, and I'm using str(myField) to convert it for a report. Obviously, if it's a real number I want decimal places str(myField,2), but if it's a real than I don't need/want the decimal places. The issue is that type('myField') returns 'N' for either real or integer.
>
>Thanks in advance


You can check
? EMPTY(myField%1) && true then integer
or you can change the logic and rtrim(str()) zeroes and decimal point
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform