ASP LBound and UBound function

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

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.