ASP LBound and UBound function
The LBound function returns the smallest subscript for the indicated dimension of an array. The LBound for any dimension is ALWAYS 0.
The UBound function returns the largest subscript for the indicated dimension of an array.
Syntax
LBound(arrayname[,dimension])
Parameter Description
arrayname - Required. The name of the array variable
dimension - Optional. Which dimension’s lower bound to return. 1 = first dimension, 2 = second dimension, and so on. Default is 1
UBound(arrayname[,dimension])
Parameter Description
arrayname - Required. The name of the array variable
dimension - Optional. Which dimension’s upper bound to return. 1 = first dimension, 2 = second dimension, and so on. Default is 1
Example 1
dim a(10)
a(0)=”India”
a(1)=”China”
a(2)=”Japan”
a(3)=”USA”
a(4)=”Australia”
a(5)=”Pakistan”
Response.write(UBound(a))
Response.write(”<br />”)
Response.write(LBound(a))
Output:
10
0
