SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I get the length of array(i)?

    Im pretty new to asp. At first I thought I could use something like array(i).length, but that doesnt work in asp. I found out about Ubound. Ubound doesn't work for something like this though

    i=5
    Ubound(array(i))

    Im having trouble inside the inner for loop because I need to reference that incremented variable "i" in the array to get the length. How do I get the length of array(i)?

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    i=5 means sets the value of variable i to 5. i is not an array variable. Now if you did this:
    Code:
    Dim i(1) 'Make an array i with 2 elements (0-based, so 1 means 2 elements)
    i(0)=5
    i(1)=10
    Response.write i(0) & " : " & i(1) & " : " & Ubound(i)
    You would get the output:
    Code:
    5 : 10 : 1
    Ian Anderson
    www.siteguru.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •