Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Integer or Real
Message
 
 
À
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:
01557141
Vues:
68
>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

If MyField = cast(MyField as I)

then you know that even if this is a real number, it doesn't have digits after .
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform