Split, combine ok but where's extract?

David Vaughan dvk at dvkconsult.com.au
Sat Feb 12 18:43:53 EST 2005


Xavier

This is the merge part
Assume you have the following two variables:
v1 contains "a"
v2 contains "b"

   split v2 with return
   put 1 into i
   repeat for each line x in v1
     put v2[i] into myArray[x]
   end repeat
   combine myArray with return and comma

myArray is now a list whose first line is "a,b"

This code avoids any "repeat with i = 1 to n" loops and is thus fairly 
linear in time taken with longer lists.

Incidentally, I left "with return" off a couple of lines in the 
previous extract code.

I have not done any speed tests.

Hope this is relevant.

regards
David


More information about the use-livecode mailing list