Negative Numbers and NumberFormat

Mark Waddingham mark at livecode.com
Wed Apr 5 15:07:21 EDT 2017


I should say the bit of engine code which does parsing and application of the numberformat has been left untouched in terms of what it does for as long as I can remember... It is one of those places where a subtle change could break apps quite easily as it is somewhat hard to see precisely what it should and should not do!

Mark

Sent from my iPhone

> On 5 Apr 2017, at 19:56, Mark Waddingham via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
>> On 2017-04-05 20:28, Bob Sneidar via use-livecode wrote:
>> And here is an oddity again. In the dictionary, there is no mention of
>> spaces or any other character besides "0.#" being valid in a
>> numberformat string, but:
>> set the numberformat to " 00";put -09+0 & ":" & 00+0 & ":" & 00+0
>> produces -09:000:000
>> In fact, you can put ANYTHING in place of a 0, and it will treat it as
>> though it were a 0!
>> Whaaaaa???
> 
> I think the numberFormat is perhaps just appearing to do more than it actually does. Basically it allows you to set the field width before and after a decimal point. So:
> 
>  set the numberFormat to "<N anything>.<M anything>"
> 
> Will result in the engine padding either side of the decimal point up to the specified number of chars with 0 if the length of that part is less than the specified width.
> 
> Whether or not the '-' sign should be included in these width calculations I guess is a matter of debate...
> 
> Warmest Regards,
> 
> Mark.
> 
> P.S. Apologies for missing your actual point before, I should have read the thread in more detail before posting ;)
> 
> -- 
> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list