Array trouble
-
Hello, I'm creating a parser for some logs derived from ssh. I used an array to split the logs for every "next line" I encounter then I have to go through all those lines again (one by one) to check for certain keywords. My problem is after going through the 1st index, the 2nd index acquires a "next line" at the beginning meaning my search can't function accurately. My question is how do I remove that line at the beginning of my 2nd index? I've tried TRIM and REPLACE but none of it doesn't seem to work. Many thanks for any help you could give me. :) Oh by the way I'm prehistoric...this is done in vb6 :) Here's my code:
a = txtSam.Text
strarray = Split(a, Chr(13))
For b = 0 To 3
strarray(b) = Replace(strarray(b), Chr(13), "")
strarray(b) = Trim(strarray(b))
If Mid(strarray(b), 21, 4) = "[15]" Then
pos1 = InStr(1, strarray(b), "<")
strurl = Mid(strarray(b), pos1)
strurl = Replace(strurl, "<", "")
strurl = Replace(strurl, ">", "")
strurl = Trim(strurl)
ElseIf Mid(strarray(b), 21, 4) = "Sent" Then
pos1 = InStr(1, strarray(b), "[msg")
pos2 = InStr(1, strarray(b), "[udh")
str1 = Mid(a, pos1, pos2 - pos1)
str1 = Replace(str1, "[msg:", "")
str1 = Trim(str1)
str1 = Mid(str1, InStr(1, str1, ":") + 1)
str1 = StrReverse(str1)
str1 = Mid(str1, 2)
str1 = StrReverse(str1)
End If
Next bAim small, miss small
-
Hello, I'm creating a parser for some logs derived from ssh. I used an array to split the logs for every "next line" I encounter then I have to go through all those lines again (one by one) to check for certain keywords. My problem is after going through the 1st index, the 2nd index acquires a "next line" at the beginning meaning my search can't function accurately. My question is how do I remove that line at the beginning of my 2nd index? I've tried TRIM and REPLACE but none of it doesn't seem to work. Many thanks for any help you could give me. :) Oh by the way I'm prehistoric...this is done in vb6 :) Here's my code:
a = txtSam.Text
strarray = Split(a, Chr(13))
For b = 0 To 3
strarray(b) = Replace(strarray(b), Chr(13), "")
strarray(b) = Trim(strarray(b))
If Mid(strarray(b), 21, 4) = "[15]" Then
pos1 = InStr(1, strarray(b), "<")
strurl = Mid(strarray(b), pos1)
strurl = Replace(strurl, "<", "")
strurl = Replace(strurl, ">", "")
strurl = Trim(strurl)
ElseIf Mid(strarray(b), 21, 4) = "Sent" Then
pos1 = InStr(1, strarray(b), "[msg")
pos2 = InStr(1, strarray(b), "[udh")
str1 = Mid(a, pos1, pos2 - pos1)
str1 = Replace(str1, "[msg:", "")
str1 = Trim(str1)
str1 = Mid(str1, InStr(1, str1, ":") + 1)
str1 = StrReverse(str1)
str1 = Mid(str1, 2)
str1 = StrReverse(str1)
End If
Next bAim small, miss small
You probably also need to remove the newline character. So, after removing the carriage return character, do a replace to remove the newline character. Those two lines of code will look like...
strarray(b) = Replace(strarray(b), Chr(13), "")
strarray(b) = Replace(strarray(b), Chr(10), "")Hopefully that will do the trick for you...
-
You probably also need to remove the newline character. So, after removing the carriage return character, do a replace to remove the newline character. Those two lines of code will look like...
strarray(b) = Replace(strarray(b), Chr(13), "")
strarray(b) = Replace(strarray(b), Chr(10), "")Hopefully that will do the trick for you...