Trailing Zeros

Jim Ault JimAultWins at yahoo.com
Sun Sep 3 10:34:29 EDT 2006


Function format(specification string, value)

Returns a formatted string that has been transformed according to the rules
of the C "printf()" function.
Make note of that this is predicated on a PRINT function, which means it is
geared to padding the result with spaces if needed, thus the charLength
determines the total characters returned in order to build print outs.

In Rev, it is easy to simply
put format("%0.2f",1256.7/3.3) = round, no leading spaces, add trailing 0's
= '380.82'

put format("%0.10f",1256.7/3.3) = round, no leading spaces, add trailing 0's
= '380.8181818182'

put format("%40.10f",1256.7/3.3) = round, add trailing 0's, and spaces to
make a total of 40 chars
= '                          380.8181818182'

put format("%40.2f",1200/3) = round, add trailing 0's, and spaces to make a
total of 40 chars
= '                                  400.00'

put format("%40.10f",1200/3) = round, add trailing 0's, and spaces to make a
total of 40 chars
= '                          400.0000000000'

Hope this helps,

Jim Ault
Las Vegas

On 9/3/06 7:07 AM, "Mark Schonewille" <m.schonewille at economy-x-talk.com>
wrote:

> set the numberformat to "#.00"
> put 1234*1
> 
> --
> 
> Economy-x-Talk
> Consultancy and Software Engineering
> http://economy-x-talk.com
> http://www.salery.biz
> 
> Get your store on-line within minutes with Salery Web Store software.
> Download at http://www.salery.biz
> 
> Op 3-sep-2006, om 15:53 heeft Camm29 het volgende geschreven:
> 
>> I have been using Round(number,x)
>> 
>> I wish to keep trailing Zero's
>> 
>> 1234.00
>> 
>> 1234.50 etc etc
>> 
>> I can only get
>> 
>> 1234
>> 1234.5
>> 
>> no zero's . i know i'm missing something simple !!!
>> 
>> Regarda
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the Use-livecode mailing list