using "split" to build multi-dimensional arrays ?
Alex Tweedly
alex at tweedly.net
Tue Jun 7 14:27:08 EDT 2005
jbv wrote:
>>Better use a different char to combine the array if you want to split
>>it later back into an array.
>>You used the comma already as an itemdelimiter.
>>
>>
>>
>
>Thanks for the tip, but why do array delimiters have to be
>different from itemdelimiter ?
>There's nothing on this in the documentation...
>Is it a known bug ?
>
>
>
The problem you're seeing is that you have a variable (say, X) with
lines like
2,5,e
and you try to split it ("split X by CR and comma").
you're hoping for
X[2,5] = e
But what you'd actually get is
X[2] = 5,e
because split takes the *first* instance of the split char (in this case
comma)
The problem therefore is that you have the same char(",") for the split
delimiter as for the array dimension delimiter.
It's not a bug, and it's not a general requirement - it's just a
restriction for doing the split in the way you are trying to do it.
--
Alex Tweedly http://www.tweedly.net
-------------- next part --------------
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.6.2 - Release Date: 04/06/2005
More information about the use-livecode
mailing list