Sign in to follow this  
Followers 0
Luigi

Get a value in second array...

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Yes Herb191, that is this!

Work fine, thank you!

Namaste!


Visit my repository

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