Jump to content

array help


Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...