Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dropping decimals when printing a report
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01123493
Message ID:
01130708
Views:
13
Sergey,

I looked at your code and it's far more elegant than mine. I have tested it and it returns the same results that I had already achieved. I have replaced my code with yours.

Thanks!

Regards,

Ron

>What about
PROCEDURE RemoveDecimals (nNumber as number)
>* be aware, the number is retured as a string!!!! without trailing zero's
>LOCAL nCounter, cNewNumber, lcPoint, lcChar
>cNewNumber = ALLTRIM(STR(nNumber,20,10))
>lcPoint = SET("POINT")
>FOR nCounter = LEN(cNewNumber) TO 1 STEP -1
>	lcChar = SUBSTR(cNewNumber,nCounter,1)
>	DO CASE
>	CASE lcChar = lcPoint
>		cNewNumber = LEFT(cNewNumber, nCounter-1)
>		EXIT
>	CASE lcChar = "0"
>		* Skip it
>	OTHERWISE
>		cNewNumber = LEFT(cNewNumber, nCounter)
>		EXIT
>	ENDCASE
>ENDFOR
>
>RETURN (cNewNumber )
>
>>
>>very elegant. I will keep this in mind. I hadn't noticed that the trim function had changed to this in VFP9. Unfortunately these applications still run in VFP8.
>>I solved it like this.
><snip>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform