post your comment   print   send to a friend
Rate:   0% | Views: 297
Question categories:  ASP

How do I extract the contents of an array without knowing the size of the array?

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?

Customer Feedback
Rate:   0% | Views: 297 | Please Rate:  
 
If you have other comments or ideas for future technical tips, please type them here:

Email: (optional)

Comments: (optional)

 Web Hosting | Professional Web Design    Back to serch results
Browse the Base
Knowledge Base
Web Design
  Do It Yourself
    ASP
Messages
 

$75 Free Google AdWords

Free $75 Google AdWords when you sign up for WebImage! Target by location, create your own, or let Google create your ads for you. Check out http://www.aplus.net/google.html to see how AdWords works for you.

Private Area
 
Ask
in Private
   
Personal
Folder
 
Related Questions
 
1. How can I display all of the contents of a single-dimension array?
 
2. Does ASP.Net still recognize the global.asa file?
 
3. Is it possible to run client-side .NET code within a browser?
 
4. What happened to date() and time()?
 
5. How do I display data on a web page using arrays instead of Do...While...MoveNext...???
 
Home Browse Search Ask in Private Personal Folder   Help
powered by web hosting 
  Logged as: Guest