Speaking of Filter and Match...

Terry Judd terry.judd at unimelb.edu.au
Sat Mar 12 23:12:55 EST 2022


There are sure to be more elegant ways but you could just rebuild the list skipping the duplicates as you go

# tList1 contains original list
put cr into tList2
repeat for each line x in tList1
    if tList2 contains cr&x&cr then # ensures you check whole not partial lines
        # do nothing
   else
        put x&cr after tList2
    end if
end repeat
put char 2 to -2 of tList2 into tList2 # delete the leading and trailing returns

If you need to retain line specific formatting in the field though you’ll need a different approach.

Terry…

Terry Judd | Senior Lecturer in Medical Education
Department of Medical Education<https://medicine.unimelb.edu.au/school-structure/medical-education>
The University of Melbourne<https://www.unimelb.edu.au/>
M: 61-435 961 594
E: terry.judd at unimelb.edu.au<mailto:terry.judd at unimelb.edu.au>
Publications<https://scholar.google.com/citations?user=XC5s6wwAAAAJ&hl=en>


From: use-livecode <use-livecode-bounces at lists.runrev.com> on behalf of Roger Guay via use-livecode <use-livecode at lists.runrev.com>
Date: Sunday, 13 March 2022 at 1:55 pm
To: use-livecode at lists.runrev.com <use-livecode at lists.runrev.com>
Cc: Roger Guay <irog at mac.com>
Subject: Speaking of Filter and Match...
I have a field with about a thousand lines with many duplicate lines, and I want to delete the duplicates. Seems like this should be simple but I am running around in circles. Can anyone help me with this?

Thanks,
Roger
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


More information about the use-livecode mailing list