Jump to content
Sign in to follow this  
Cap0

array help

Recommended Posts

Cap0

here's my code:

$f = "why hello"
$a = stringreplace($f," ","")
Dim $arr[stringlen($a) / 2 - 1]
for $i = 0 to stringlen($a) / 2 - 1
    $arr[$i] = "hey"
Next
Msgbox(0,'',$arr[2])

i get error: array variable has incorrect number of subcripts or dimension range has exceeded; something along those lines.

Share this post


Link to post
Share on other sites
Shevilie

To simplify i used a constant

Dim $arr[2]
for $i = 0 to 2
    $arr[$i] = "hey"
NextoÝ÷ Ù8b³¥¥ê¹Çê뢷nzÚ4ߦ«®+6n(ºØ§Ê«)Ê­¯+hz{^¯}5Ù8b²+-éè®f¥Á¬­¢f¤y©h¢è­¬!¢W®¶²jëh×6Dim $arr[2]
for $i = 0 to (UBound($arr] - 1)
    $arr[$i] = "hey"
Next

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites
Uten

Use Dim $arr[Round(stringlen($a) / 2 - 1, 0)]

when you dimension the array don't think 3/2=1.5 will go down well..:)

Share this post


Link to post
Share on other sites
Cap0

Hi,

Thanks for the replies! works good, thanks again.

Share this post


Link to post
Share on other sites
Shevilie

Use Dim $arr[Round(stringlen($a) / 2 - 1, 0)]

when you dimension the array don't think 3/2=1.5 will go down well..:)

Uuuh didn't see that.. good catch

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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.