Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Deleting an element from an array


Message #1 by "Rob Levs" <info@i...> on Thu, 13 Feb 2003 03:50:24
I'm new to this list so I hope this is on topic.

Does anyone know of good way to delete an element from an array.  I 
suspect I may need to re-create the array without the element in 
question.  If this is the case, what would be the most efficient way to do 
this.

Thanks so much,

Rob
Message #2 by "phil griffiths" <pgtips@m...> on Thu, 13 Feb 2003 10:08:25
Hi Rob,

Arrays suck for this sort of thing.  I would use a "Scripting.Dictionary" 
object instead - it has Remove() and RemoveAll() methods, e.g.

Set d = Server.CreateObject("Scripting.Dictionary")
d.Add "a", "1st item"
d.Add "b", "2nd item"
d.Add "c", "3rd item"
...
d.Remove "b"

hth
Phil
>----------------------------------------------
> I'm new to this list so I hope this is on topic.

> Does anyone know of good way to delete an element from an array.  I 
s> uspect I may need to re-create the array without the element in 
q> uestion.  If this is the case, what would be the most efficient way to 
do 
t> his.

> Thanks so much,

> Rob

  Return to Index