ASP Is Fun

Learning ASP
Free ASP Course
ASP Basics
ASP Functions
SQL Commands
Sample ASP Code

Servers / Setup
ASP Host Reviews
ASP Server Setup
ASP Error Tips

Contract ASP
ASP Development

Search For:

Intro to ASP


UBound ASP Array Function

The UBound function lets you find out what the top defined array member is. This makes it easy for you to loop through an array from start to finish.

Let's say you use the split function to parse out a string into an array. So you do:

Dim ListArray

SentStr = "Four score and seven years ago our fathers brought forth"
ListArray = split(SentStr, " ")

Now you have an array ListArray that you want to cycle through, but you don't know how far to go. How do you know when you've reached the end?

The answer is the ubound function. ubound gives you the topmost array member of an array. In this case, the array has 10 words in it. Since arrays always start numbering at zero, this means array spots 0 through 9 are taken. If you do


the result is 9.

You can then easily do a loop through the members, operating on each one -

for loopctr = 0 to ubound(ListArray)
response.write ListArray(loopctr)

ASP Array Function List

Bookmark this site so you can reference it any time you have ASP questions in the future!

Add ASP+Functions+ to Twitter Add ASP+Functions+ to Facebook Add ASP+Functions+ to MySpace Add ASP+Functions+ to Digg ASP+Functions+ Add ASP+Functions+ to Yahoo My Web Add ASP+Functions+ to Google Bookmarks Add ASP+Functions+ to Stumbleupon Add ASP+Functions+ to Reddit


Get Emails when this Site is Updated

ASP Ebooks | Free ASP Course |
All content copyright 2014 Minerva WebWorks LLC. All rights reserved.

Exploring Believability

Free Newsletter!

Intro to ASP
ASP Members
ASP Shopping

Introduction to ASP

ASP Poll
How do you handle 500 errors?
I don't
Page does nothing
Displays error
Emails error