|
It
is possible to get the upper and lower bounds of an array by using the UBound
and the LBound functions, but it is faster and
easier to extract the array information without these functions.
The following
snippet of code displays each element of the array aFoo
using a 'For Each...Next' loop.
'Create the aFoo array
Dim aFoo
aFoo = Array("Hello", "Aplus!", "How ", "are ", "you?")
Dim iItem
For Each iItem in aFoo
Response.Write iItem & "<BR>"
Next
The above code will produce the
following output (when viewed through a browser):
Hello
Aplus!
How
are
you?
This example loops through each
element in the array. If there are no more elements in the array, the
loop will end.
Another approach is to extract the
contents from an array using a 'For ... Next' Loop. Furthermore, if you
want all of the array's contents in a single string, you can use the join
function. For an example of using both of these techniques, go to the
FAQ article: How
can I display all of the contents of a single-dimension array?
|