Jump to content
BatMan22

Adding Two arrays

Recommended Posts

BatMan22

So I am trying to add two arrays that I've pulled data from via the _Excel_RangeRead function and simply add a space in between them. And Concatenate apparently isn't what I'm looking for and neither is insert or add...

All I am trying to do is add two arrays in this fashion

$aArrayTarget[5] = ["0", "1", "2", "3", "4"]
$aArraySource[5] = ["A", "B", "C", "D", "E"]

So something like...

$aArraySum = $aArrayTarget & "blah" & $aArraySource

that would yield

$aArraySum= [0blahA, 1blahB, 2blahC, 3blahD, 4blahE]

in the sum array.

What I DONT want is 0, 1, 2, 3, 4, A, B, C, D, E which I've managed to recreate like 5 different ways now. :(

 

Thanks guys :)

 

 

 

Share this post


Link to post
Share on other sites
Jfish

Like this?

#include <Array.au3>

global $aArrayTarget[5] = ["0", "1", "2", "3", "4"]
global $aArraySource[5] = ["A", "B", "C", "D", "E"]


for $a=0 to ubound($aArraySource)-1
    $aArrayTarget[$a]=$aArrayTarget[$a]&"Blah"&$aArraySource[$a]
Next
_ArrayDisplay($aArrayTarget)

 


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
BatMan22

Dammit I hate being dumb when it comes to programming.  Yes, That's exactly what I wanted, you rock dude.

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

×