Código fuente de 'Elimina valor en array.asp'

<html>

<head>
<title>Elimina valor en array - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>

<p align="center"><b><font size="3">Elimina valor en array</font></b>
<body style="font-family: Arial; font-size: 11pt"></p>

<%
sub BorrarElemento (ByRef aArray, ByRef sString)

	dim iTemp
	dim iUBound

	dim bFound

	bFound = False
	iUBound = UBound(aArray)

	for iTemp = 0 to iUBound
		if (aArray(iTemp) = sString) then
			aArray(iTemp) = aArray(iUBound)
			bFound = True
		end if
	next

	if (True = bFound) then redim preserve aArray(iUBound - 1)

end sub


Vector = Array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
Response.write "<b>Este es el array: </b><br>" 
for n=lbound(vector) to ubound(vector)
response.write vector(n)
next

response.write "<br>"
BorrarElemento vector,2

response.write "<br><b>Y este es el array borrando el elemento 2 (BorrarElemento vector,2): </b><br>" 

for n=lbound(vector) to ubound(vector)
response.write vector(n)
next

%>

</body>
</html>