Jump to content

remove element from array


netcracker

Recommended Posts

:) how can i remove an element from an array??somenthing like "MyArray.splice(index,1)" in javascriptor a function like "ArrayRemoveItem" or something....please help! :) thx
Link to comment
Share on other sites

thx for the quick response.i've already seen those, and they don't really help. one of them is about .NET and the other removes le last item... or something.i need a solution to delete an element which index i know.

Link to comment
Share on other sites

Try this....

dim arr(9)arr(0)=1arr(1)=2arr(2)=3arr(3)=4arr(4)=5arr(5)=6arr(6)=7arr(7)=8arr(8)=9Call RemoveElementFromArray(1,arr)' parameter ind is Index of the element in arrayPublic Function RemoveElementFromArray(ind,vals)dim ii = 0'ind = 9lTop = UBound(vals)lBottom = LBound(vals)response.write(ltop &", "& lbottom &", "& ind)If ind < lBottom Or ind > lTop-1 Then  response.write("ERROR: Index out of range")Else  for i = ind to lTop-1	  vals(i) = vals(i+1)  nextEnd Iffor i=0 to 8response.write("<br>")response.write(vals(i))nextend function

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...