Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding position of decimal
Message
From
22/03/2001 00:40:33
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00487442
Message ID:
00487519
Views:
8
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform