Jump to content
Sign in to follow this  

arraysearch, is this a bug?

Recommended Posts


Hi guys, can you help me out a bit here?

I have an $arrayx[10][11]

$arrayx[6][11] = "h2o"

I tried to search what row that has "h2o" but failed, so I make a simple test a "2d" array first

#include <Array.au3>
Local $avArray[6][2] = [ _
["String0", "am2"], _
["String1", "am6"], _
["String2", "am9"], _
["String3", "am4"], _
["String4", "hail"], _
["String5", "am3"]]

$sSearch = InputBox("_ArraySearch() demo", "String to find?")
If @error Then Exit

For $i=0 to 3 ;-- ignore this, cuz maybe I got it upside down
    $iIndex = _ArraySearch($avArray, $sSearch, 0, 0, 0, 0, $i)
    If @error Then
        MsgBox(0, "Not Found", '"' & $sSearch & '" was not found on column ' & $i & '.')
        MsgBox(0, "Found", '"' & $sSearch & '" was found in the array at position ' & $iIndex & ' on column ' & $i & '.')

The result "am4" is nowhere to be found, is this correct?

Edited by danny1878

Share this post

Link to post
Share on other sites

The seventh parameter is $iForward not the $iSubItem to check. Perhaps you've meant:

$iIndex = _ArraySearch($avArray, $sSearch, 0, 0, 0, 0, 1, 1)

..the it's assumed the you know which column it's on because you've search in that column, it only returns the row index.

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.