Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Give me length of decimal places.
Message
De
08/06/1998 03:48:26
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, Royaume Uni
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00105714
Message ID:
00105715
Vues:
23
>Hi Folks,
>
> My requirement is to know the number of decimal places in a numeric expression.
>For example
>
>Passing 123.456 should return 3
> 13.234533 should return 6
>
>Thanks in advance
>
>Jayesh
Hi,
Here's a function to do what you want. It could be done as a one-line expression but it would be quite long.

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
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform