ASP中UBOUND與LUBOUND的使用方法
UBound函數(shù)
返回一個 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ù)一起使用,用來確定一個數(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ù)的使用 返回數(shù)組的指示維度的最大可用下標(biāo)。
如:
<%
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("請選擇一個投票項!")
end if
%>
因為split 函數(shù)將獲取來的復(fù)選框值按照分隔符‘ ,'分割,以一個數(shù)組的數(shù)據(jù)格式存放起來,現(xiàn)在要依次輸出有哪些復(fù)選項被選中,用的是一個for循環(huán),for 循環(huán)變量的確定就得用ubound函數(shù)
相關(guān)文章
javascript asp教程第十三課--include文件
javascript asp教程第十三課--include文件...2007-03-03IIS 錯誤 Server Application Error 詳細(xì)解決方法
IIS 錯誤 Server Application Error 詳細(xì)解決方法...2007-02-02asp實現(xiàn)批量錄入數(shù)據(jù)的實現(xiàn)
asp實現(xiàn)批量錄入數(shù)據(jù)的實現(xiàn)...2006-12-12