Skip to content

Instantly share code, notes, and snippets.

@davebrny
Last active November 13, 2017 14:04
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 davebrny/982a35ebfa43871846ff8c9a1cda3c24 to your computer and use it in GitHub Desktop.
Save davebrny/982a35ebfa43871846ff8c9a1cda3c24 to your computer and use it in GitHub Desktop.
(autohotkey) - clear a split array/object array
clear_split(byRef name) {
loop, % isObject(name) ? name.maxIndex() : %name%0
{
%name%%a_index% := ""
name[a_index] := ""
}
%name%0 := ""
name := ""
}
@davebrny
Copy link
Author

davebrny commented Nov 13, 2017

clear_split("split")     <--- name in quotes

list := "one,two,three"

stringSplit, split, list, `,
total := "split0"
msgBox, % "total: " %total% "`n`n" split1 "`n" split2 "`n" split3

clear_split("split")

total := "split0"
msgBox, % "total: " %total% "`n`n" split1 "`n" split2 "`n" split3

 

clear_split(split)     <--- variable/object name

list := "one,two,three"

split := strSplit(list, ",")
msgBox, % "total: " split.maxIndex() "`n`n" split[1] "`n" split[2] "`n" split[3]

clear_split(split)

msgBox, % "total: " split.maxIndex() "`n`n" split[1] "`n" split[2] "`n" split[3]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment