Function GetStringBetween(ByVal Str1 As String, ByVal str2 As String, ByVal str3 As String) As String
'textbox.Text = GetStringBetween(sData, "first", "last")
Dim s1, s2, s3 As Long, foundstr As String
foundstr = String.Empty
s1 = Str1.IndexOf(str2)
s2 = Str1.IndexOf(str3)
If (s1 = -1 Or s2 = -1) Then
Return "" 'Not Found!
End If
If (s2 <> 0) Then
s3 = s1 + str2.Length
foundstr = Str1.Substring(s3, s2 - s3)
Else
Return "" 'Not Found!
End If
Return foundstr
End Function
|