Home > ASP Development > Deleting array element

Deleting array element



I made a array StrCalls like this:



strCalls = Split(compl, ":")



Now i want to delete lets sat value 17 (and the index) I read this is how it could be done:



StrCalls.delete ('17')



but it gives me the error (even though i dont have functions):



Object required: 'strCalls'





How to do this?

    
Guest


Are you doing this in ASP or ASP.NET?



Please correct if I am wrong, but I don't believe it's that simple to delete a value. I think you might have to do it the old fashion way.

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by ublguy
Are you doing this in ASP or ASP.NET?



Please correct if I am wrong, but I don't believe it's that simple to delete a value. I think you might have to do it the old fashion way.




asp.. And what is the 'old fashion way' ?

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by Pter
asp.. And what is the 'old fashion way' ?




I was hoping you weren't going to ask that question. Well, the only way I know of is by recreating the array.



1) Step through each value of the array, and put it back into a delimeted string but ommiting the 17 spot. Then redo the split. Realy nasty I know, but it will work and won't slow you down much - except if you are talking an array with thousands/millions long.

Was this answer helpful ? Yes No   
Guest


Something like this


Code:


dim iCurrent, iElementToDelete
for iCurrent = iElementToDelete to ubound(strCalls) - 1
  strCall(iCurrent) = strCalls(iCurrent+1)
next
redim preserve strCalls(ubound(strCalls)-1)




This hasn't been tested and is only to give you the idea

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by elijathegold
Something like this




Code:



dim iCurrent, iElementToDelete
for iCurrent = iElementToDelete to ubound(strCalls) - 1
strCall(iCurrent) = strCalls(iCurrent+1)
next
redim preserve strCalls(ubound(strCalls)-1)






This hasn't been tested and is only to give you the idea




I like this one better!

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved