scripter73
Programmer
Hi,
Does anyone out there know a way to delete an array element from an array?
Background: I split a string into an array so I could get a portion of it into a variable. I don't need that portion of the array anymore so I blanked it out. However, now I just want to get rid of the blank entry in my array. Following is the code:
dim strRequest 'desired string
dim strFound 'boolean
dim numberChar 'variable holder
dim theParts 'Array
dim theString
theString = "10.11.130.80 - - [01/May/2001:13:52:59 -0600] 'GET /insuredacct/index.cfm HTTP/1.0' 200 355 "
'split string into Array Parts, array automatically creates
theParts = split(theString,"'"
strFound = False
For i = LBound(theParts) to UBound(theParts)
numberChar = left(theParts(i), 4)
response.write "<br>" & numberChar
If strcomp(numberchar, "GET "=0 then
'assign that part to the strRequest variable
strRequest = theParts(i)
strFound = True
'now that we located strRequest, replace its section in array with blanks
theParts(i) = " "
response.write "<br>" & "String was replaced with blanks."
exit for 'after finding string, exit loop
End If
Next
'**********************
'REVIEW PARTS POST-SEARCH
'**********************
response.write "<hr></hr>"
response.write "<B>Part Review (After Search)</B> <br>"
For i = LBound(theParts) to UBound(theParts)
response.write theParts(i) & "<br>"
Next
response.write "<hr></hr>"
If I print out my Array, here's what I have:
Part Review (After Search)
10.11.130.80 - - [01/May/2001:13:52:59 -0600]
200 355
All I want now is:
Part Review (After Search)
10.11.130.80 - - [01/May/2001:13:52:59 -0600]
200 355
Because I'll have to split these up too based on spaces.
Your help is greatly appreciated.
Thanks in advance,
scripter73
Does anyone out there know a way to delete an array element from an array?
Background: I split a string into an array so I could get a portion of it into a variable. I don't need that portion of the array anymore so I blanked it out. However, now I just want to get rid of the blank entry in my array. Following is the code:
dim strRequest 'desired string
dim strFound 'boolean
dim numberChar 'variable holder
dim theParts 'Array
dim theString
theString = "10.11.130.80 - - [01/May/2001:13:52:59 -0600] 'GET /insuredacct/index.cfm HTTP/1.0' 200 355 "
'split string into Array Parts, array automatically creates
theParts = split(theString,"'"
strFound = False
For i = LBound(theParts) to UBound(theParts)
numberChar = left(theParts(i), 4)
response.write "<br>" & numberChar
If strcomp(numberchar, "GET "=0 then
'assign that part to the strRequest variable
strRequest = theParts(i)
strFound = True
'now that we located strRequest, replace its section in array with blanks
theParts(i) = " "
response.write "<br>" & "String was replaced with blanks."
exit for 'after finding string, exit loop
End If
Next
'**********************
'REVIEW PARTS POST-SEARCH
'**********************
response.write "<hr></hr>"
response.write "<B>Part Review (After Search)</B> <br>"
For i = LBound(theParts) to UBound(theParts)
response.write theParts(i) & "<br>"
Next
response.write "<hr></hr>"
If I print out my Array, here's what I have:
Part Review (After Search)
10.11.130.80 - - [01/May/2001:13:52:59 -0600]
200 355
All I want now is:
Part Review (After Search)
10.11.130.80 - - [01/May/2001:13:52:59 -0600]
200 355
Because I'll have to split these up too based on spaces.
Your help is greatly appreciated.
Thanks in advance,
scripter73