Jump to content
Sign in to follow this  
DigitalIsBetter

Count Items in Array

Recommended Posts

DigitalIsBetter

Probably a noob question but when I make an array with stringregexp how do i know how many matchs it found? I know i can do _arraydisplay but I need to set a variable to the number of items in the array.

Thanks for any help in advance.

Edited by Learning

Share this post


Link to post
Share on other sites
Valuater

Maybe...

$array = StringRegExp('<test>a</test> <test>b</test> <test>c</Test>', '<(?i)test>(.*?)</(?i)test>', 3)

MsgBox(0x0, "total", UBound($array))

for $x = 0 to UBound($array) -1
    MsgBox(0x0, "Number " & $x, $array[$x], 2)
Next

Ubound() is your friend!!!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
DigitalIsBetter

Maybe...

$array = StringRegExp('<test>a</test> <test>b</test> <test>c</Test>', '<(?i)test>(.*?)</(?i)test>', 3)

MsgBox(0x0, "total", UBound($array))

for $x = 0 to UBound($array) -1
    MsgBox(0x0, "Number " & $x, $array[$x], 2)
Next

Ubound() is your friend!!!

8)

Thanks man didnt know about Unbound

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.