Jump to content

Recommended Posts

Posted

I'm am trying to add values to a multi-dimensional array using the _ArrayAdd function. I can't figure out the syntax for it though. Here is what I have, but it doesn't work.

$temparray = StringSplit($fileline, Chr(9))

_ArrayAdd($someArray, $temparray[1], $temparray[2])

Thanks!

Posted

I'm am trying to add values to a multi-dimensional array using the _ArrayAdd function. I can't figure out the syntax for it though. Here is what I have, but it doesn't work.

$temparray = StringSplit($fileline, Chr(9))

_ArrayAdd($someArray, $temparray[1], $temparray[2])

Thanks!

_ArrayAdd works only on 1 dimensional array

I would ReDim array by 1 and loop through all indexes

Posted

I'm am trying to add values to a multi-dimensional array using the _ArrayAdd function. I can't figure out the syntax for it though. Here is what I have, but it doesn't work.

$temparray = StringSplit($fileline, Chr(9))

_ArrayAdd($someArray, $temparray[1], $temparray[2])

Thanks!

I think that _ArrayAdd like _ArrayDisplay, was designed only for unidimensional arrays.
Posted

StringSplit() returns a single dimensional array

here is a good example of this conmbined with _ArrayAdd()

#include <Array.au3>


$days = StringSplit("Sun,Mon,Tue,Wed,Thu,Fri", ",")
;$days[1] contains "Sun" ... $days[7] contains "Sat"


for $x = 1 to $days[0]
    MsgBox(0,"test", " The Day is " & $days[$x] & "  ")
Next

_ArrayAdd($days, "Sat")

for $x = 1 to $days[0] +1
    MsgBox(0,"test", " The Day is " & $days[$x] & "  ")
Next

_ArrayAdd adds to the END of the array

8)

NEWHeader1.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...