Gopher2011
Well-known member
Hi,
I have been looking for examples to find the string between two strings. This top one works fine;
Now the first one is fine - Ext_Volume is result of the string between the strings <Volume> and </Volume>.
<Volume> and </Volume> are unique so this is straight forward.
However the second one - "^FDExp:" is unique, but "^FS" is not unique.
There are occurances of "^FS" before and after "^FDExp:".
How do I get the string to search AFTER the occurrence, not before etc?
Sorry I cant help more but I really don't know the terminology of the words for what I am trying to do, so its harder to find on google.
Most examples are to find fixed sized strings using mid and the number of chars you want to get etc.
I have been looking for examples to find the string between two strings. This top one works fine;
VB.NET:
Public Sub ReadData(ByRef keywordStart As String, ByRef keywordEnd As String, ByVal filename As String)
Using reader = New StreamReader(filename)
Dim line As String = reader.ReadToEnd()
'Debug.WriteLine(line)
Dim Index_Vol1 As Integer = line.IndexOf("<Volume>") + 8
Dim Index_Vol2 As Integer = line.IndexOf("</Volume>")
Dim Ext_Volume As String = line.Substring(Index_Vol1, Index_Vol2 - Index_Vol1).Trim
Debug.WriteLine("Extraction: " & Ext_Volume)
Dim Index_Exp1 As Integer = line.IndexOf("^FDExp:") + 7
Dim Index_Exp2 As Integer = line.IndexOf("^FS")
Dim Ext_Exp As String = line.Substring(Index_Exp1, Index_Exp2 - Index_Exp1).Trim
Debug.WriteLine("Extraction: " & Ext_Exp)
End Using
End Sub
Now the first one is fine - Ext_Volume is result of the string between the strings <Volume> and </Volume>.
<Volume> and </Volume> are unique so this is straight forward.
However the second one - "^FDExp:" is unique, but "^FS" is not unique.
There are occurances of "^FS" before and after "^FDExp:".
How do I get the string to search AFTER the occurrence, not before etc?
Sorry I cant help more but I really don't know the terminology of the words for what I am trying to do, so its harder to find on google.
Most examples are to find fixed sized strings using mid and the number of chars you want to get etc.