Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check for number of digits in a number
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00598086
Message ID:
00598150
Vues:
24
Yes, I tested under VFP 7 before I posted my code. The only case it doesn't work if there are only 0's after decimal point.

>If so, this was a behavior change in TRANSFORM() function. Are you sure?
>
>>Actulay it works in VFP 7.
>>
>>>Nope, this would not work. This was my original solution too.
>>>
>>>
>>>>>Hi everyone,
>>>>>
>>>>>I've checked old messages, but didn't find a solution for this problem: I need to find out the number of digits in a number. Say, I have 12.3456000 - the number of digits should be seven. I don't see a simple solution, so may be you can advise?
>>>>>
>>>>>Thanks a lot in advance.
>>>>
>>>>Would this do?
lnNumber = 12.3456000
>>>>IF AT( ".", TRANSFORM(lnNumber)) = 0
>>>>  lnDp = 0
>>>>ELSE
>>>>  lnDp = LEN(TRANSFORM(lnNumber)) - AT( ".", TRANSFORM(lnNumber))
>>>>ENDIF
>>>>* or in one line
>>>>lnDp = IIF( AT( ".", TRANSFORM(lnNumber)) = 0, 0, LEN(TRANSFORM(lnNumber)) - AT( ".", TRANSFORM(lnNumber)))
>>>>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform