Jump to content
Sign in to follow this  

stringsplit multidimensional array

Recommended Posts


So I have an array like this:

1, 2

3, 4

I used stringsplit with @crlf for a delimiter. So now how do I split each row in the array into two columns? Am I even going about this the right way?

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post

Link to post
Share on other sites

#include <Array.au3>

Global $avArray1, $avArray2[1][2] = [[0]], $avTmp
Global $sStr = '1, 2' & @CRLF & '3, 4, 5' & @CRLF & '6, 7' & @CRLF & '8'

$avArray1 = StringSplit($sStr, @CRLF, 1)

For $i = 1 To $avArray1[0]
    $avTmp = StringSplit($avArray1[$i], ',', 2)
    $avArray2[0][0] += 1
    If UBound($avTmp) > UBound($avArray2) Then
        ReDim $avArray2[$avArray2[0][0]+1][UBound($avTmp)]
        ReDim $avArray2[$avArray2[0][0]+1][UBound($avArray2, 2)]
    For $j = 0 To UBound($avTmp)-1
        $avArray2[$avArray2[0][0]][$j] = $avTmp[$j]


Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.