Good idea, thanks Dick. Your scripts are always so elegant.
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On March 14, 2022 7:11:13 PM Dick Kriesel via use-livecode
<use-livecode@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
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode