How do you convert a list (eg "1,2,3,4") into an array?

Get help with using AutoHotkey and its commands and hotkeys
Diablo Sauce
Posts: 16
Joined: 20 Sep 2019, 12:54

How do you convert a list (eg "1,2,3,4") into an array?

26 Nov 2019, 14:27

My list is just a variable, like:

x=1,2,3,4,99,33

Thank you.
User avatar
Masonjar13
Posts: 1514
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: How do you convert a list (eg "1,2,3,4") into an array?

26 Nov 2019, 14:30

strSplit

Code: Select all

x:="1,2,3,4,99,33"
array:=strSplit(x,",")
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
Chunjee
Posts: 501
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

Re: How do you convert a list (eg "1,2,3,4") into an array?

26 Nov 2019, 14:44

"," is the default separator for https://biga-ahk.github.io/biga.ahk/#/?id=split

Code: Select all

A := new biga()
x := "1,2,3,4,99,33"

Array := A.split(x)
; => [1, 2, 3, 4, 99, 33]
String := A.join(Array)
; => "1,2,3,4,99,33"
ExitApp
you can also .join and array back into a string as demonstrated above.

Return to “Ask For Help”

Who is online

Users browsing this forum: afe, AHKStudent, Bing [Bot], c7aesa7r, coris, Google [Bot] and 163 guests