日期:2014-05-17  浏览次数:21215 次

asp怎么移除数组中某个项目
例如
A   =   Array(10,20,30)
我想移除20怎么做

------解决方案--------------------
str= " "
for i=0 to ubound(a)
str=str& a(i) & ", "
next

str=replace(str,char& ", ", " ") //char要删除的element
execute( "redim a=array( "&str& ") ")
------解决方案--------------------
Public Function ArrayPop(arr, key)
Dim tmp
tmp = ", " & Join(arr, ", ") & ", "
tmp = Replace(tmp, ", " & key & ", ", ", ")
ArrayPop = Split(Mid(tmp, 2, Len(tmp) - 2), ", ")
End Function

Dim arr
arr = Array(10, 20, 30)
Response.Write Join(ArrayPop(arr, 20), ", ")