找回密码
 加入
搜索
查看: 3797|回复: 6

怎样获取二维数组的最大下标?

  [复制链接]
发表于 2008-10-30 15:07:23 | 显示全部楼层 |阅读模式
如题,一个二维数组 想知道怎样获取这个数组的元素个数

[ 本帖最后由 duxuetao1201 于 2008-10-30 15:44 编辑 ]
 楼主| 发表于 2008-10-30 15:44:13 | 显示全部楼层
没人会吗?
还是自己来吧
发表于 2010-4-30 17:23:20 | 显示全部楼层
我也想知道啊!
发表于 2010-4-30 17:51:01 | 显示全部楼层
dim $a[10][5]
MsgBox(0,0,"["&UBound($a,1)&"]["&UBound($a,2)&"]")

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2010-4-30 18:52:03 | 显示全部楼层
autoit中的例子
Dim $myArray[10][20]   ;element 0,0 to 9,19
$rows = UBound($myArray)
$cols = UBound($myArray, 2)
$dims = UBound($myArray, 0)

MsgBox(0, "The " & $dims & "-dimensional array has", _
        $rows & " rows, " & $cols & " columns")

;Display $myArray's contents
$output = ""
For $r = 0 to UBound($myArray,1) - 1
        $output = $output & @LF
        For $c = 0 to UBound($myArray,2) - 1
                $output = $output & $myArray[$r][$c] & " "
        Next
Next
MsgBox(4096,"Array Contents", $output)
发表于 2010-7-29 23:21:59 | 显示全部楼层
4楼的解答不错,值得尝试下
发表于 2014-7-22 15:26:04 | 显示全部楼层
4楼的正解 不错
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 06:19 , Processed in 0.099213 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表