Sign in to follow this  
Followers 0
DigitalIsBetter

Count Items in Array

5 posts in this topic

#1 ·  Posted (edited)

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



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

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

UBound, not Unbound ;)

Means "Upper Boundary"

Share this post


Link to post
Share on other sites

UBound, not Unbound :D

Means "Upper Boundary"

Or constipated:
If $iCheese > $iLimit Then Ubound(":")

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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