[thelist] ASP: checking for empty array

lon.kraemer lwkraemer at earthlink.net
Thu Apr 12 22:06:20 CDT 2001

VBscript arrays are 0 based.

Ubound returns the largest available subscript for the indicated dimension
of an array. Since Dim arrYes(0) then UBound(arrYes)=0. It'll pass =>0, but
will certainly fail >0

Then again, in this case, isempty(arrYes(0))=false
if arrYes(0) = "value" had not been stated then

Dim arrYes(10)
UBound(arrYes)=10 even if each element is empty.

if Dim arrYes() [dynamic array] then isempty(arrYes(0)) throws an error (out
of range)

isarray(arrYes) can be used when the array is created implicitly, such as
with GetRows, to determine whether an array was built or not based on the
data returned.

Simple, huh?
Lon Kraemer
Web Design/ASP Development

----- Original Message -----
From: "Warden, Matt" <mwarden at odyssey-design.com>
Subject: Re: [thelist] ASP: checking for empty array

> Dim arrYes(0)
> arrYes(0) = "value"
> > if UBound(arrYes) > 0 then
> > ...blah blah...
> > end if
> arrYes is a valid array here, yet it fails the above test.
> this one's got me stumped and had me scouring
> http://msdn.microsoft.com/scripting
> Didn't find a test for an empty array.
> --
> mattwarden
> mattwarden.com

More information about the thelist mailing list