numberFormat affecting array keys???

Bob Sneidar bobsneidar at iotecdigital.com
Fri Apr 21 11:34:56 EDT 2017


OIC. NumberFormat is a STRING function. So then...:
set the numberFormat to "00"; put 1+1 into tValue; put tValue produces "02" because livecode converts EVERYTHING to a string before outputting it. It makes more sense I suppose to put it that way. I have gotten into the habit of thinking that numbers are numbers because it happens so seamlessly. 

It really doesn't matter though, because the bottom line is that I need to create my own number formatting function, which is no big deal. If it's any good I'll post it for review and refinement. 

Bob S


> On Apr 21, 2017, at 08:18 , Mark Waddingham via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Yes - i is a number (as it is the index of the for loop) so the value
> of the array element is a number, and so appears as '1' (not affected
> by numberFormat).
> 
> However, array keys are *always* strings, so when you set the array key
> numberFormat comes into play and the key is '01' and not '1'.
> 
> Warmest Regards,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps





More information about the use-livecode mailing list