Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dropping decimals when printing a report
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01123493
Message ID:
01130743
Vues:
16
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform