Remove all duplicate from list

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
maitresin
Posts: 45
Joined: 20 Mar 2018, 19:33

Remove all duplicate from list

27 Aug 2020, 19:48

Hi,

I want to delete all double value, not only the duplicate. Keep only non duplicate.

EX:
1
1
2
3
3
4
4
5


Result : 2, 5

Sort, var, U

Remove duplicate and keep all unique but I need to keep only non duplicate. What is the option for this??

Thanks
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Remove all duplicate from list

27 Aug 2020, 20:02

Code: Select all

EX =
(
1
1
2
3
3
4
4
5
)

arr := {}

Loop, Parse, EX, `n, `r
    if arr.HasKey(A_LoopField)
        arr[A_LoopField] += 1
    else
        arr[A_LoopField] := 1

for item, cnt in Arr
    if (cnt = 1)
        output .= item . ","
    
MsgBox % RTrim(output, ",")

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arbibarbarona, Bing [Bot], mikeyww, peter_ahk and 99 guests