Manipulating Arrays

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Manipulating Arrays

04 Nov 2013, 22:37

Flash has the following methods for manipulating an array:
  • push - add an element to the end of the array
    pop - removes the last element
    splice - insert/delete elements in the middle
    unshift - add an element to the beginning of the array
IS there anything similar for arrays in AHK? I'm thinking especially about stringsplit. Thanks.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Manipulating Arrays

05 Nov 2013, 00:19

Yes, but StringSplit doesn't create an array. It creates a pseudo-array; a bunch of individual variables.

If you have v1.1.13 or later, you can use StrSplit() instead. It returns an array (object).

For arrays (objects), the Insert and Remove methods cover most/all of that functionality.
Wade Hatler
Posts: 60
Joined: 03 Oct 2013, 19:49
Location: Seattle Area
Contact:

Re: Manipulating Arrays

05 Nov 2013, 00:21

.Insert(value) works like push()
.Remove() without parameters works like pop()
.Insert(1, value) inserts at the beginning
.Insert(key, value) is like splice

Objects
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Manipulating Arrays

05 Nov 2013, 19:28

Thank you both for the links and examples. I'll try using strSplit()

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, prototype_zero, w_i_k_i_d and 337 guests