我正在處理ASP經典的array_merge函數。我似乎正在工作,直到一個(或兩個)參數爲空或不是數組。這是我到目前爲止有:ASP經典中的數組合並
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
我得到的錯誤:
Error Type: Microsoft VBScript runtime (0x800A01B6) Object doesn't support this property or method: 'merged' /_inc/nav/left-nav.inc, line 21
從線merged(right_size + i + 1) = right(i)
。任何智慧我要去哪裏錯了?
當你發現錯誤時,輸入是什麼? – 2010-10-19 16:28:34
只是拋出了這個 - 'LEFT'和'RIGHT'是VBScript中的函數。是否有可能代碼實際上是在「正確的(i)」上?您可能想要更改函數的參數名稱。 – LittleBobbyTables 2010-10-19 16:31:07