UBound函數(shù)
返回一個(gè) Long 型數(shù)據(jù),其值為指定的數(shù)組維可用的最大下標(biāo)。
語法
UBound(arrayname[, dimension])
UBound 函數(shù)的語法包含下面部分:
部分 描述
arrayname 必需的。數(shù)組變量的名稱,遵循標(biāo)準(zhǔn)變量命名約定。
dimension 可選的;Variant (Long)。指定返回哪一維的上界。1 表示第一維,2 表示第二維,以此類推。如果省略 dimension,就認(rèn)為是 1。
說明
UBound 函數(shù)與 LBound 函數(shù)一起使用,用來確定一個(gè)數(shù)組的大小。LBound 用來確定數(shù)組某一維的上界。
對具有下述維數(shù)的數(shù)組而言,UBound 的返回值見下表:
Dim A(1 To 100, 0 To 3, -3 To 4)
語句 返回值
UBound(A, 1) 100
UBound(A, 2) 3
UBound(A, 3) 4
asp ubound() 函數(shù)的使用 返回?cái)?shù)組的指示維度的最大可用下標(biāo)。
如:
復(fù)制代碼 代碼如下:
%
chkitems = Trim(Request("chk"))
if chkitems > "" then
chkitem = split(chkitems,",")
'for i=0 to ubound(chkitem)
'Response.Write(chkitem(i) "br />")
'next
else
Response.Write("請選擇一個(gè)投票項(xiàng)!")
end if
%>
因?yàn)閟plit 函數(shù)將獲取來的復(fù)選框值按照分隔符‘ ,'分割,以一個(gè)數(shù)組的數(shù)據(jù)格式存放起來,現(xiàn)在要依次輸出有哪些復(fù)選項(xiàng)被選中,用的是一個(gè)for循環(huán),for 循環(huán)變量的確定就得用ubound函數(shù)
您可能感興趣的文章:- VBS教程:函數(shù)-UBound 函數(shù)