ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾VBScript£¾VBScript


objects constants operators statements functions properties methods






FUNCTION:  LBound( )

LBound(ArrayName, Dimension)

The LBound function returns the lower limit for the elements in an array.

By default, in the current versions of VBScript, the LBound function always returns a zero.


There is one mandatory argument.

ArrayName

The ArrayName argument is the name of the array. Do not include the parenthesis with the array name.

Code:
<% Dim catarray(3) %>
<% catarray(0) = "Mountain lion" %>
<% catarray(1) = "Bobcat" %>
<% catarray(2) = "Jaguar" %>
<% =LBound(catarray) %>

Output:
0

There is one optional argument.

Dimension

The optional Dimension argument is used to identify which index you are determining the lower bounds for in a multi-dimensional array.

Code:
<% Dim fisharray(2,3) %>
<% fisharray(0,0) = "Neon tetra" %>
<% fisharray(0,1) = "Angle fish" %>
<% fisharray(0,2) = "Discus" %>
<% fisharray(1,0) = "Golden dojo" %>
<% fisharray(1,1) = "Clown loach" %>
<% fisharray(1,2) = "Betta" %>
<% =LBound(fisharray, 2) %>

Output:
0