Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Decimal precision is of a variable
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00136301
Message ID:
00136695
Vues:
24
>Is there a command that returns the decimal precision of a variable?
>
>Example a=1.00 is 2 decimal
> a=1 is 0
>
>TIA

Try following function

FUNCTION LenDecimals
LPARAMETER tnTestNum
LOCAL lcNumber, lnPos, lnResult

lcNumber = LTRIM( PADL( tnTestNum, 99))
lnPos = AT( ".", lcNumber)
IF lnPos = 0
lnResult = 0
ELSE
lnResult = LEN( lcNumber) - lnPos
ENDIF

RETURN lnResult


Bye
Jayesh
- Jayesh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform