formatting data in a field

David Coker davidocoker at gmail.com
Sun Apr 4 10:35:48 EDT 2010


Thanks to both Pete and Sarah for the added input...

Sarah added:
> I prefer to use format. You then don't have to do the dummy
> calculation to set it in place, and you know exactly what number it is
> applying too, while numberFormat can end up applying to more numbers
> than you expected.
>
> So I would use:
>   put format("%.2f", 3.1666) into fld "Whatever"

That's exactly what I was trying to do and in fact looks very much the
same as the way I was trying it. I think my misunderstanding has to do
with how to use the 3.1666 which is stored in a variable. e.g.

tCount = 3.166
put format("%.2f", tCount) into fld "Whatever"

In my situation, the actual value of the number involved is completely
informational and of no great importance elsewhere. All I am trying to
accomplish is to improve the appearance to the user.

If you can shed some light there, I would appreciate it.
Best regards,
David C.



More information about the Use-livecode mailing list