Speaking of Filter and Match...

J. Landman Gay jacque at hyperactivesw.com
Tue Mar 15 13:00:38 EDT 2022


Good idea, thanks Dick. Your scripts are always so elegant.

--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On March 14, 2022 7:11:13 PM Dick Kriesel via use-livecode 
<use-livecode at lists.runrev.com> wrote:
>
> Since order must be maintained, it’s probably faster not to split and sort, 
> and faster not to scan the list repeatedly using lineOffset or contains.
> You could do it like this:
>
> command removeDuplicates pDelimitedList, pDelimiter
>   local tArray, tList
>   set the lineDelimiter to pDelimiter
>   repeat for each line tLine in pDelimitedList
>      if not tArray[tLine] then -- i.e., if this line hasn't appeared already, 
>      then ...
>         put true into tArray[tLine]
>         put tLine & pDelimiter after tList
>      end if
>   end repeat
>   delete last char of tList
>   return tList for value
> end removeDuplicates
>
> — Dick






More information about the use-livecode mailing list