Jump to content

Get a value in second array...


Luigi
 Share

Recommended Posts

Hi, I try find a value in one $avArray, get your position, and retrieve another value in the same position in anoter $avArray2.

It's work with any value <> 0.

If I search 'a' letter, the script return all $avArray2... But I want only letter 'A'.

I make wrong code or exist sintax error?

#include <Array.au3>
Local $avArray[5] = ["a", "b", "c", "d", "e"]
Local $avArray2[5] = ["A", "B", "C", "D", "E"]
$find = "b"
Local $aiResult = _ArrayFindAll($avArray, $find)
ConsoleWrite("The letter '" & $find & "' was found in position '" & _ArrayToString($aiResult) & "'." & @LF)
ConsoleWrite(_ArrayToString($avArray2,"",_ArrayToString($aiResult),_ArrayToString($aiResult)) & @LF)

Thanks. ^^

Edited by detefon

Visit my repository

Link to comment
Share on other sites

I am not sure if this is what your are looking for...

#include <Array.au3>
Local $avArray[6] = ["a", "b", "c", "d", "e", "f"]
Local $avArray2[6] = ["A", "B", "C", "D", "E", "A"]
$find = "a"
Local $aiResult = _ArrayFindAll($avArray, $find)
ConsoleWrite("The letter '" & $find & "' was found in position '" & _ArrayToString($aiResult) & "'." & @LF)
For $i = 0 To UBound($aiResult, 1) -1
ConsoleWrite($avArray2[$aiResult[$i]] & @LF)
Next
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...