filter command

yves COPPE yvescoppe at skynet.be
Wed Apr 10 12:50:01 EDT 2002


>At 4:53 pm +0100 10/4/02, Dave Cragg wrote:
>
>>function commonLines pList1, pList2
>>   repeat for each line tLine in pList1
>>     put 1 into tArray[tLine]
>>   end repeat
>>   repeat for each line tLine in pList2
>>     add 1 to tArray[tLine]
>>   end repeat
>>   put keys(tArray) into tKeys
>>   repeat for each line tKey in tKeys
>>     if tArray[tKey] > 1 then
>>       put tKey & cr after tRetVal
>>     end if
>>   end repeat
>>   delete char -1 of tRetVal
>>   return tRetVal
>>end commonLines
>
>I wasn't thinking too hard. The above works if the lines in each 
>list are unique, but not if there may be duplicate lines.
>
>This is better, I think.
>
>function commonLines pList1, pList2
>   repeat for each line tLine in pList1
>     put 1 into tArray[tLine]
>   end repeat
>   repeat for each line tLine in pList2
>     if tArray[tLine] = 1 then
>       put 2 into tArray[tLine]
>       put tLine & cr after tRetVal
>     end if
>   end repeat
>   delete char -1 of tRetVal
>   return tRetVal
>end commonLines



How, now it's fine, your correction gives the best result.
Can you adapt your script for filtering lines in fld one that are not 
in fld two and gives as result the lines in fld one that are NOT in 
fld two.

thanks
-- 
Greetings.

Yves COPPE

Email : yvescoppe at skynet.be



More information about the use-livecode mailing list