Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transform(x,?????)
Message
 
To
06/01/2005 19:20:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00974835
Message ID:
00974918
Views:
23
Perfect Fabio! I will just add a mask for the integer part...

For example:
? FormatNumber(123456.00,12,6,2) && Returns 123,456.00

Thanks.... and, of course, congratulations for the "Personality"!

>
>try this:
>
>? formatNumber(12.210010,12,6,2)
>? formatNumber(145.00,12,6,2)
>? formatNumber(145.003,12,6,3)
>? formatNumber(145.000,12,6,3)
>? formatNumber(145.123456,12,6,3)
>
>FUNCTION formatNumber(nValue,iMaxLen,iMaxDec,iMinDec)
>* iMaxLen>=iMaxDec+2 ; iMaxDec>=iMinDec>=0
>RETURN LEFT(STR(m.nValue,m.iMaxLen,m.iMaxDec),m.iMaxLen-m.iMaxDec+m.iMinDec);
>+CHRTRAN(RTRIM(CHRTRAN(RIGHT(STR(m.nValue,m.iMaxLen,m.iMaxDec),m.iMaxDec-m.iMinDec),"0"," "))," ","0")
>
>
>Fabio
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rodolfo Duarte
Previous
Reply
Map
View

Click here to load this message in the networking platform