Eliminate doubles in a long list field

Igor Couto igor at pixelmedia.com.au
Sat Jun 28 01:29:00 EDT 2003


Dear Ludovic,

On Saturday, June 28, 2003, at 03:57  PM, Ludovic Thébault wrote:

> I've a long list field with double entry
>
> I want to eliminate double.
>
> I use this script :
>
>  repeat for each line l in myLongList
>    if l is not in myLongListWithoutDouble then
>      put l&cr after myLongListWithoutDouble
>    end if
>  end repeat
>
> But it's long. There is an another solution ? Thanks.
>

How about this:

sort lines of field cMyLongListField
repeat with x = (the number of lines in field cMyLongListField) down to 
2
	if (line x of field cMyLongListField is line (x-1) of field 
cMyLongListField)
	then delete line x of field cMyLongListField
end repeat

I haven't tried, but I suspect it might be faster - I don't really 
know... You will, of course, end up with a SORTED list of unique lines 
- and I don't know whether that will pose a problem for you as well or 
not!

I hope this helps!

Kind Regards,

--
Igor de Oliveira Couto
----------------------------------
igor at pixelmedia.com.au
----------------------------------




More information about the use-livecode mailing list