[Gambas-user] Array sizes, and hello

Matt Simmons bandman at ...626...
Fri Jan 7 15:47:27 CET 2005


Hey everyone, 

I'm a brand new Gambas user, and I wanted to say hello, and first off
thank everyone who's put a ton of work into this project. It really
shows, and I've enjoyed the short time I've been working with this.

I've been through the documentation, and for the life of me, I haven't
been able to find a function to determine the size of an array that's
been created on the fly. I'm creating an array from a split()
function, and I needed to verify that there were enough items created.
I ended up writing my own sizeof(), since I am use to PHP. Forgive me
if someone else has done the same, or if there's an equivalent already
in the language.


PUBLIC FUNCTION sizeof(arrInput AS String[]) AS Integer

DIM arrUnit AS String
itemCount AS Integer
itemCount = 0

FOR EACH arrUnit IN arrInput 
   INC itemCount
NEXT

RETURN itemCount

END


It's simple, but it should save a little time, hopefully. Thanks again! 

--Matt Simmons




More information about the User mailing list