netcracker Posted March 15, 2007 Share Posted March 15, 2007 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 More sharing options...
pulpfiction Posted March 15, 2007 Share Posted March 15, 2007 Guess there is no function you can use to remove item from array...check this outhttp://www.dotnetindex.com/articles/3232_W...ove_An_Item.asphttp://www.freevbcode.com/ShowCode.asp?ID=585 Link to comment Share on other sites More sharing options...
netcracker Posted March 15, 2007 Author Share Posted March 15, 2007 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 More sharing options...
pulpfiction Posted March 15, 2007 Share Posted March 15, 2007 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now