'Returns the array's specified dimension size.
'Dimension zero will return the array's number of dimensions and respective sizes.
'getDimSize by 'wonder', based on the solution provided by 'eurojam' at B4X forums
'https://www.b4x.com/android/forum/threads/getting-the-length-of-a-multi-dimensional-array.54614/#post-342944
Sub getDimSize(MyArray As Object, Dimension As Int) As String
Dim r As Reflector
Dim temp As String
Dim dims() As Int
r.Target = MyArray
dims = r.TargetRank
If Dimension <= 0 OR Dimension > dims.Length Then
For idx = 0 To dims.Length - 1
temp = temp & dims(idx)
If idx < dims.Length - 1 Then temp = temp & ", "
Next
Return dims.Length & "D Array: {" & temp & "}"
Else
Return dims(Dimension - 1)
End If
End Sub