Did you ever have two arrays that you needed to merge together? If you were programming in PHP, you used the array_merge() function. If you were programming in ASP, you had to write a whole bunch of code because there is no array_merge() function... until now.
ASP
function array_merge(byVal firstArray, byVal secondArray)dim totalSizedim idim combinedArray' Ensure that we're dealing with arrays.if not isArray(firstArray) thenfirstArray = Array(firstArray)end ifif not isArray(secondArray) thensecondArray = Array(secondArray)end if' Set up the new array.totalSize = uBound(firstArray) + uBound(secondArray) + 1combinedArray = firstArrayredim preserve combinedArray(totalSize)for i = 0 to uBound(secondArray)combinedArray(uBound(firstArray) + 1 + i) = secondArray(i)nextarray_merge = combinedArrayend function

No comments:
Post a Comment