Reversing Arrays in ASP


/ Published in: ASP
Save to your folder(s)

ASP does not have a built in function to reverse or sort array like other languages. Find out how to do it.


Copy this code and paste it in your HTML
  1. articlesRev = array( _
  2. "array item 0", _
  3. "array item 1", _
  4. "array item 2", _
  5. "array item 3" _
  6. )
  7.  
  8. Dim articles()
  9. ubnd = UBound(articlesRev)
  10. Redim articles(ubnd)
  11. for i = 0 to ubnd
  12. articles(ubnd - i) = articlesRev(i)
  13. next
  14.  
  15. for i=0 to ubound(articles)
  16. response.Write(articles(i)&"<br>")
  17. next

URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=10

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.