Estoy trabajando en una función array_merge para ASP clásico. Lo que tengo parece estar funcionando, hasta que uno (o ambos) params estén vacíos o no arrays. Esto es lo que tengo hasta ahora:combinación de matriz en ASP clásico
function array_merge(left, right)
dim total_size
dim i
dim merged
' Convert "left" to an array
if not isArray(left) then
left = Array(left)
end if
' Convert "right" to an array
if not isArray(right) then
right = Array(right)
end if
' Start with "left" and add the elements of "right"
right_size = ubound(right)
total_size = ubound(left) + right_size + 1
merged = left
redim preserve merged(total_size)
for i = 0 to ubound(right)
merged(right_size + i + 1) = right(i)
next
' Return value
array_merge = merged
end function
me sale el error:
Error Type: Microsoft VBScript runtime (0x800A01B6) Object doesn't support this property or method: 'merged' /_inc/nav/left-nav.inc, line 21
Desde la línea de merged(right_size + i + 1) = right(i)
. ¿Alguna idea de dónde me estoy equivocando?
¿Cuál fue la entrada cuando recibió ese error? –
Simplemente lanzando esto: 'LEFT' y' RIGHT' son funciones en VBScript. ¿Es posible que el código en realidad esté barfing en 'right (i)'? Es posible que desee cambiar los nombres de los parámetros de la función. – LittleBobbyTables