如何在ASP classic中取消设置数组元素?

时间:2013-04-29 00:12:22

标签: arrays asp-classic unset

ASP Classic是否等同于PHP unset(array1[3])函数?

1 个答案:

答案 0 :(得分:3)

我认为这样做,对于数值数组,至少:

sub unset(array, index)
   if index < lbound(array) or index > ubound(array) then exit sub

   dim i, move
   move = false
   for i = lbound(array) to ubound(array)
      if i = index then move = true

      if move and i < ubound(array) then
         array(i) = array(i + 1)
      end if
   next

   redim preserve array(i - 2)  
end sub