P
Przemek
Hi, I'm trying to parse some text file, which contain blocks of text.
First my code:
Public Class Parser
Public Sub New(ByVal fs As String)
Dim sr As StreamReader
sr = My.Computer.FileSystem.OpenTextFileReader(fs)
Dim strLine As String
Dim outLine As String
Dim lineCount As Short
outLine = ""
strLine = sr.ReadLine()
Do Until strLine = "-}"
outLine = outLine + strLine
MsgBox(strLine)
strLine = sr.ReadLine()
Loop
MsgBox(outLine)
sr.Close()
End Class
The problem is, that the length of the text block is unknown. I only
know for sure, that each block is separated from the next one by two
chars "-}" in line. My code read first block, I've got my outLine
variable (I will pass it to another object, parse and load into
database), but I don't how to continue parsing my file starting from
the line after "-}" line.
First my code:
Public Class Parser
Public Sub New(ByVal fs As String)
Dim sr As StreamReader
sr = My.Computer.FileSystem.OpenTextFileReader(fs)
Dim strLine As String
Dim outLine As String
Dim lineCount As Short
outLine = ""
strLine = sr.ReadLine()
Do Until strLine = "-}"
outLine = outLine + strLine
MsgBox(strLine)
strLine = sr.ReadLine()
Loop
MsgBox(outLine)
sr.Close()
End Class
The problem is, that the length of the text block is unknown. I only
know for sure, that each block is separated from the next one by two
chars "-}" in line. My code read first block, I've got my outLine
variable (I will pass it to another object, parse and load into
database), but I don't how to continue parsing my file starting from
the line after "-}" line.