The UBound function returns a Long type data whose value is the maximum subscript available for the specified array dimension.
UBound function
Returns a Long whose value is the largest subscript available for the specified array dimension.
grammar
UBound(arrayname[, dimension])
The syntax of the UBound function consists of the following parts:
partial description
arrayname required. The name of the array variable, following standard variable naming conventions.
dimension Optional; Variant (Long). Specifies the upper bound for which dimension to return. 1 represents the first dimension, 2 represents the second dimension, and so on. If dimension is omitted, it is assumed to be 1.
illustrate
The UBound function is used together with the LBound function to determine the size of an array. LBound is used to determine the upper bound of a certain dimension of the array.
For arrays with the following dimensions, UBound returns values as shown in the following table:
Dim A(1 To 100, 0 To 3, -3 To 4)
Statement return value
UBound(A, 1) 100
UBound(A, 2) 3
UBound(A, 3) 4
Usage of the asp ubound() function returns the maximum available subscript for the indicated dimension of the array.
like:
Copy the code code as follows:
<%
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("Please select a voting item!")
end if
%>
Because the split function divides the obtained check box value according to the delimiter ',' and stores it in an array data format. Now it is necessary to output in sequence which check boxes are selected, using a for loop and a for loop variable. To be sure, you have to use the ubound function