Jump to content

Array not counting up

Recommended Posts

Am having an issue am trying to split an text file on every : Then putting it back in an array but can't seem to get it to work.

_FileReadToArray ( $prompt, $_Array )

$c = 1

While $c < $_Array[0]
$_Array2 = StringSplit($_Array[$c], ':')
$c += 1

The Problem is that it will constantly overwrite $_Array2[1]

Sample Source file:



what I would like to see in array:

$_Array2[1] "User1"

$_Array2[2] "pw"

$_Array2[3] "User2"

$_Array2[4] "pw"

I tried adding a counter to $_Array2 but then I get an syntax error. If any one could help me out or point me in the right direction it would be appreciated

Link to comment
Share on other sites

_FileReadToArray($prompt, $a_Array)

$i_newelements = $a_Array[0] * 2 + 1
Dim $a_Array2[$i_newelements]

For $i=1 To $a_Array[0]
    $a_Array2[$j] = $a_temp[1]
    $j += 1
    $a_Array2[$j] = $a_temp[2]
    $j += 1

Or you want to use _ArrayAdd(). But maybe slower because you do a ReDim on every call.

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

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...