Sign in to follow this  
Followers 0
58hoo

Concatenating variables to form an index

4 posts in this topic

I would like to concatenate some numeric variables (values 0 thru 9) to produce an index into an array. For example, I have three variables:

Global $Var1

Global $Var2

Global $Var3

$Var1 = 0

$Var2 = 8

$var3 = 4

Concatenating these ($Var1 Var2 Var3) to produce 084 which I would then use to index an array.

Is there an easy way to do this?

Thanks,

Share this post


Link to post
Share on other sites



maybe...

Dim $c1[4]

$c1[0] = 4
$c1[1] = 1
$c1[2] = 2
$c1[3] = 3

Dim $array[2]

$array[1] = $c1[0] & $c1[1] & $c1[2] & $c1[3] 

MsgBox(0x0, "Test","1=" & $c1[0] &@LF &  _
"2=" &$c1[1]&@LF & _
"3=" &$c1[2]&@LF & _
"4=" &$c1[3]&@LF & _
"or " &$array[1] )

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

couldnt you just...

$concatenated = Int ($var1 & $var2 & $var3)

?


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Thanks! Both suggestions work great.

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  
Followers 0