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:
01130743
Views:
14
Hi Ron,

I'm glad the code is usefull to you.

>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 )
>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform