-1 as last item problem

Dennis Brown see3d at writeme.com
Fri May 13 21:08:15 EDT 2005


I have some data that looks like this:

1,ABT,N,510,,Y
3,AMT,N,836,,
22,AL,N,132,F,Y

as you can see, each line has exactly 6 items.
if I do the following:

put item 1 to 6 of line 1 of data

I get this:

1,ABT,N,510,,Y
3,AMT,N,836,,
22,AL,N,132,F,Y

If I do the following:

put item 1 to -1 of line 1 of data

I get this:

1,ABT,N,510,,Y
3,AMT,N,836,
22,AL,N,132,F,Y

Notice the missing last comma on the second line.  It does not matter  
how many commas I append, it will always leave off the last one  
unless there is another character at the end.  Unless I do not  
understand how this is supposed to work, this is a bug.  Yes?

This little gotcha has cost me a lot of time to figure out, because  
it was subtly changing my database.  I looked everywhere trying to  
figure out why my data had a slight bias that I did not believe  
should be there.

Dennis


More information about the use-livecode mailing list