Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
Sly Kitty. :-) Bob S > On Apr 21, 2017, at 09:53 , J. Landman Gay via use-livecode > wrote: > > Alternately, put a space after pSourceString to force it to text, which will > apply numberformat, and then return word 1 of it. > > -- > Jacqueline Landman Gay

Re: numberFormat affecting array keys???

2017-04-21 Thread J. Landman Gay via use-livecode
Alternately, put a space after pSourceString to force it to text, which will apply numberformat, and then return word 1 of it. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On April 21, 2017 11:31:36 AM Bob

Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
Okay this is why they call me Sly Dawg. I used the engine quirk against it to produce this: on mouseUp repeat with i = 1 to 10 put formatNumber(i, "00") into myArray [i] end repeat breakpoint end mouseUp function formatNumber pSourceString, pFormat set the numberFormat to

Re: numberFormat affecting array keys???

2017-04-21 Thread Mike Kerner via use-livecode
Here's an interesting case I ran into: long time - hours can be single digits, e.g. "8", but minutes and seconds are always two digits, e.g. "00", and, of course, setting the numberFormat does not affect anything. ___ use-livecode mailing list

Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
I could, but I will have to figure out how to convert a numberFormat string like "#0.00" to a format incantation, as the dictionary puts it. The goal is to convert ANY number to ANY numeric format, not just solve this one little issue which I could just code around if I wanted. This sort of

Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
Sorry. Change that to: put formatNumber(i, "00") into myArray [i] and it does NOT work. adding 0 to the value with numberFormat set to "00" does NOT format the number. SHEESH! Working on it. Bob S > On Apr 21, 2017, at 08:58 , Bob Sneidar via use-livecode >

Re: numberFormat affecting array keys???

2017-04-21 Thread Paul Dupuis via use-livecode
On 4/21/2017 11:34 AM, Bob Sneidar via use-livecode wrote: > 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. Why not use the existing

Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
Okay simple solution: on mouseUp repeat with i = 1 to 10 put formatNumber(i) into myArray [i] end repeat breakpoint end mouseUp function formatNumber pSourceString, pFormat set the numberFormat to pFormat add 0 to pSourceString return pSourceString end formatNumber This

Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
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

Re: numberFormat affecting array keys???

2017-04-21 Thread Mark Waddingham via use-livecode
On 2017-04-21 16:33, Bob Sneidar via use-livecode wrote: I got that wrong. I could say I expected the value to be 01. Also if you see the value of i in the debugger, it indicates that the value of i is 1 and NOT 01. So it HAS to be the array designation that is doing it. Yes - i is a number

Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
I got that wrong. I could say I expected the value to be 01. Also if you see the value of i in the debugger, it indicates that the value of i is 1 and NOT 01. So it HAS to be the array designation that is doing it. Bob S On Apr 21, 2017, at 07:31 , Bob Sneidar via use-livecode

Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
Again, the VALUE is not being converted by numberFormat, so it ISN'T the LOOP calculation that is doing it! Otherwise the VALUE would ALSO be 1! I loop is using i and it clearly contains 1 and not 01 because that is what shows up in the value. I could put it the otherway. I could say I expected

Re: numberFormat affecting array keys???

2017-04-21 Thread Bob Sneidar via use-livecode
Now I have you! It's NOT doing math in the loop! I know this because the VALUE is 1 and NOT 01. Bob S On Apr 20, 2017, at 17:32 , hh via use-livecode > wrote: Bob S. wrote: Okay THAT has GOT to be a bug!!! Why the hell is

Re: numberFormat affecting array keys???

2017-04-21 Thread Mark Waddingham via use-livecode
On 2017-04-21 01:51, Bob Sneidar via use-livecode wrote: Put this into a button: on mouseUp set the numberFormat to "00" repeat with i=1 to 10 put i into myArray [i] breakpoint end repeat end mouseUp At the breakpoint examine the array. There will be a 1 in an element with

Re: numberFormat affecting array keys???

2017-04-20 Thread hh via use-livecode
> Bob S. wrote: > Okay THAT has GOT to be a bug!!! Why the hell is numberformat modifying the > name of the array element?? I haven't done ANY math on it. "repeat with i=1 to 10" uses i to count from 1 up to 10 step 1: That's a lot of math you've done to i. Whereas this doesn't touch the

Re: numberFormat affecting array keys???

2017-04-20 Thread hh via use-livecode
> Bob S. wrote: > Okay THAT has GOT to be a bug!!! Why the hell is numberformat modifying the > name of the array element?? I haven't done ANY math on it. "repeat with i=1 to 10" uses i to count from 1 up to 10 step 1: That's a lot of math you've done to i. Whereas this doesn't touch the

Re: numberFormat affecting array keys???

2017-04-20 Thread Jonathan Lynch via use-livecode
I would have thought that A[1] and A[01] would be the same, while A["1"] and A["01"] were different - good to know that is not the case. Sent from my iPhone > On Apr 20, 2017, at 8:04 PM, Richard Gaskin via use-livecode > wrote: > > Bob Sneidar wrote: > > > Hi

Re: numberFormat affecting array keys???

2017-04-20 Thread Paul Dupuis via use-livecode
Array keys are strings. Even when you: put 1 into tArray[1] the "1" as the array key is a string. If you do something mathematical to that key, LC converts any string that represents a number to a number when it needs to. On 4/20/2017 7:51 PM, Bob Sneidar via use-livecode wrote: > Hi all. > >

Re: numberFormat affecting array keys???

2017-04-20 Thread Richard Gaskin via use-livecode
Bob Sneidar wrote: > Hi all. > > Put this into a button: > > on mouseUp >set the numberFormat to "00" >repeat with i=1 to 10 > put i into myArray [i] > breakpoint >end repeat > end mouseUp > > At the breakpoint examine the array. There will be a 1 in an element > with the

numberFormat affecting array keys???

2017-04-20 Thread Bob Sneidar via use-livecode
Hi all. Put this into a button: on mouseUp set the numberFormat to "00" repeat with i=1 to 10 put i into myArray [i] breakpoint end repeat end mouseUp At the breakpoint examine the array. There will be a 1 in an element with the name... ready??? "01" Okay THAT has GOT