Skip to content

Instantly share code, notes, and snippets.

@grey-code
Created May 13, 2013 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grey-code/5570456 to your computer and use it in GitHub Desktop.
Save grey-code/5570456 to your computer and use it in GitHub Desktop.
AutoHotkey: RemoveDuplicate()
RemoveDuplicate(str, delim:="`n", cs:=false) {
_ := cs ? ComObjCreate("Scripting.Dictionary") : []
Loop, Parse, str, % delim
alf := A_LoopField
, out .= cs ? (_.Exists(alf) ? "" : (alf . delim, _.Add(alf, 1)))
: (_[alf] ? "" : (alf . delim, _[alf] := 1))
return RTrim(out, delim)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment