Jump to content
Sign in to follow this  
onedayillpay

for $var in $arr

Recommended Posts

onedayillpay

Local $arr[4]
$arr[1]=["ayz", 123, 11]
$arr[2]=["byz", 123, 22]
$arr[3]=["cyz", 123, 33]

for $var in $arr
;    some_func("ayz", 123, 11) 
     some_func($var.split[1], $var.split[2], $var.split[3])
next

i think this example explains the loop im trying to accomplish.... how can i set array split into 3 values

Share this post


Link to post
Share on other sites
onedayillpay

here is a better example of what im trying to do...

#include 
#include 
Local $text[5]
$text[1] = "xyz##20##0"
$text[2] = "abc##20##0"
$text[3] = "asd##20##0"
$text[4] = "sad##20##0"

for $var In $text
Local $array1 = _StringExplode($var, "##", 0)
MsgBox(1,"", $array1[0])
MsgBox(1,"", $array1[1])
MsgBox(1,"", $array1[2])
; some_func($array1[0], $array1[1], $array1[2])



Next

Share this post


Link to post
Share on other sites
kylomas

onedayillpay,

Is this what you are trying to do?

#include <string.au3>
#include <array.au3>
Local $text[5]
$text[1] = "xyz##20##0"
$text[2] = "abc##20##0"
$text[3] = "asd##20##0"
$text[4] = "sad##20##0"

local $array1

for $1 = 1 to ubound($text) - 1
    $array1 = _StringExplode($text[$1], "##", 0)
    for $2 = 0 to ubound($array1) - 1
        my_goofy_function($array1[$2])
    next
Next

func my_goofy_function($str)

    ConsoleWrite('This is my goofy value ' & $str & @LF)

endfunc

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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  

×