Sign in to follow this  
Followers 0
erifash

_ArrayDim()

2 posts in this topic

This function figures out how many dimensions there are in an array. I don't know if there already is a function like this but I searched all over. Here's the code:

Func _ArrayDim(ByRef $aArray)
    If not IsArray($aArray) Then Return 0
    If UBound($aArray, 2) Then Return 2
    Return 1
EndFunc

...and here is the example:

Dim $array1[1]
Dim $array2[1][1]
Dim $string = ""

MsgBox(0, "1 dim array", _ArrayDim($array1))
MsgBox(0, "2 dim array", _ArrayDim($array2))
MsgBox(0, "string", _ArrayDim($string))

Hope you like it!

Any comments or questions are greatly appreciated! :)

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