Extracting a column

Klaus Major klaus at major-k.de
Mon Dec 10 05:30:49 EST 2007


Bonjour Éric,

> Hello,
>
> Does somebody know if there is a "quick" way to extract a column  
> from a tab limited list (in a field or a variable)?
> By "quick" I mean I'm not obliged to cycle through all the lines of  
> my var because it can be quite long.
>
> I've tried to use array but the transpose function doesn't work if  
> the number of columns is not the same as the number of lines.
> Or can I do something else with an array to achieve that goal?

use the new "split" command!
...
put "your data here" into myvar
put 2 into my_column
## The number of column you want to extract
split myvar by column
## turns your data into an array!
put myvar[my_column] into my_column_data
...

Done :-)

> Thanks, best,
>
> ÉrIC

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de





More information about the use-livecode mailing list