Return to Snippet

Revision: 50016
at August 5, 2011 06:50 by danfsmith


Updated Code
'************************************************************
' This function takes an array and prints out the first
' or second half of the array, defaulting to print the
' first half with one additional row if Length mod 2 is not 0.
' Prototyped by: Dan Smith
'************************************************************
Sub PrintArrayHalf(Array,ArrayHalf)
	If ArrayHalf = 1 Then
		MiddleBound = ceil(UBound(Array) / 2)-1
		For Counter = 0 to MiddleBound
			Response.Write (Array(Counter)) 
		Next  			
	ElseIf ArrayHalf = 2 Then 
		LowerBound = ceil(UBound(Array) / 2)
		For Counter = LowerBound to UBound(Array)
			Response.Write (Array(Counter)) 
		Next 																
	End If													
End Sub

Revision: 50015
at August 5, 2011 01:30 by danfsmith


Updated Code
'************************************************************
' This function takes an array and prints out the first
' or second half of the array, defaulting to print the
' first half with one additional row if Length mod 2 is not 0.
' Prototyped by: Dan Smith
'************************************************************
Sub PrintArrayHalf(Array,ArrayHalf)
	If ArrayHalf = 1 Then
		MiddleBound = Round(UBound(Array) / 2)-1
		For Counter = 0 to MiddleBound
			Response.Write(Array(Counter))
		Next  			
	ElseIf ArrayHalf = 2 Then 
		LowerBound = Round(UBound(Array) / 2)
		
		For Counter = LowerBound to UBound(Array)
			Response.Write(Array(Counter))
		Next 																
	End If													
End Sub

Revision: 50014
at August 5, 2011 01:26 by danfsmith


Updated Code
'************************************************************
' This function takes an array and prints out the first
' or second half of the array, defaulting to print the
' first half with one additional row if Length mod 2 is not 0.
' Prototyped by: Dan Smith
'************************************************************
Sub PrettyPrintArray(Array,ArrayHalf)
	If ArrayHalf = 1 Then
		MiddleBound = Round(UBound(Array) / 2)-1
		For Counter = 0 to MiddleBound
			Response.Write(Array(Counter))
		Next  			
	ElseIf ArrayHalf = 2 Then 
		LowerBound = Round(UBound(Array) / 2)
		
		For Counter = LowerBound to UBound(Array)
			Response.Write(Array(Counter))
		Next 																
	End If													
End Sub

Revision: 50013
at August 4, 2011 06:15 by danfsmith


Updated Code
'************************************************************
' This function takes an array and prints out the first
' or second half of the array, defaulting to print the
' first half with one additional row if Length mod 2 is not 0.
' Prototyped by: Dan Smith
'************************************************************
Sub PrintArrayHalf(Array,ArrayHalf)
	If ArrayHalf = 1 Then
		If UBound(Array) mod 2 = 0 Then
			MiddleBound = Round(UBound(Array) / 2)-1
		Else
			MiddleBound = Round(UBound(Array) / 2)
		End If

		For Counter = 0 to MiddleBound
			Response.Write(Array(Counter))
		Next  			
	ElseIf ArrayHalf = 2 Then 
		If UBound(Array) mod 2 = 0 Then
			LowerBound = (UBound(Array) / 2) 
		Else 
			LowerBound = Round(UBound(Array) / 2)+1
		End If
		
		For Counter = LowerBound to UBound(Array)
			Response.Write(Array(Counter))
		Next 																
	End If													
End Sub

Revision: 50012
at August 4, 2011 06:15 by danfsmith


Initial Code
'************************************************************
' This function takes an array and prints out the first
' or second half of the array, defaulting to print the
' first half with one additional row if Length mod 2 is not 0.
' Prototyped by: Dan Smith
'************************************************************
Sub PrintArrayHalf(Array,ArrayHalf)
	If ArrayHalf = 1 Then
		If UBound(NavigationList) mod 2 = 0 Then
			MiddleBound = Round(UBound(NavigationList) / 2)-1
		Else
			MiddleBound = Round(UBound(NavigationList) / 2)
		End If

		For Counter = 0 to MiddleBound
			Response.Write(NavigationList(Counter))
		Next  			
	ElseIf ArrayHalf = 2 Then 
		If UBound(NavigationList) mod 2 = 0 Then
			LowerBound = (UBound(NavigationList) / 2) 
		Else 
			LowerBound = Round(UBound(NavigationList) / 2)+1
		End If
		
		For Counter = LowerBound to UBound(NavigationList)
			Response.Write(NavigationList(Counter))
		Next 																
	End If													
End Sub

Initial URL


Initial Description
Used when splitting array elements between two columns in HTML

Initial Title
Print Array Half

Initial Tags


Initial Language
ASP