Split, combine ok but where's extract?

David Vaughan dvk at dvkconsult.com.au
Sat Feb 12 17:46:20 CST 2005


Moron me! Doing some edits from my test script I omitted the line "add 
1 to i" just before " end repeat"

On 13/02/2005, at 10:43, David Vaughan wrote:

> 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