Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding position of decimal
Message
De
22/03/2001 00:40:33
 
 
À
22/03/2001 00:16:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00487442
Message ID:
00487519
Vues:
7
>>How can I find the position of the decimal point in a numerical value. I tried to convert the number to string but it rounded the value.
>>
>>thanks
>>Nick
>
>You can use TRANSFORM(numericvalue) (or any of the PADx() functions) and parse the resultant string to get the number of decimal places.

It doesn't always work; try:
CREATE CURSOR DEMO (Num1 N(10,3))
INSERT INTO DEMO1 VALUES (1.0)
INSERT INTO DEMO1 VALUES (1.1)
INSERT INTO DEMO1 VALUES (1.01)
INSERT INTO DEMO1 VALUES (12345)
SCAN
   ? TRANSFORM(Num1)  && first and last are wrong
   ? PADL(Num1,16)    && this works
ENDSCAN
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform