Print Array Half


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

Used when splitting array elements between two columns in HTML


Copy this code and paste it in your HTML
  1. '************************************************************
  2. ' This function takes an array and prints out the first
  3. ' or second half of the array, defaulting to print the
  4. ' first half with one additional row if Length mod 2 is not 0.
  5. ' Prototyped by: Dan Smith
  6. '************************************************************
  7. Sub PrintArrayHalf(Array,ArrayHalf)
  8. If ArrayHalf = 1 Then
  9. MiddleBound = ceil(UBound(Array) / 2)-1
  10. For Counter = 0 to MiddleBound
  11. Response.Write (Array(Counter))
  12. Next
  13. ElseIf ArrayHalf = 2 Then
  14. LowerBound = ceil(UBound(Array) / 2)
  15. For Counter = LowerBound to UBound(Array)
  16. Response.Write (Array(Counter))
  17. Next
  18. End If
  19. End Sub

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.