Public Function GetStringBetween(ByVal InputText As String, _
ByVal starttext As String, _
ByVal endtext As String)
Dim lnTextStart As Long
Dim lnTextEnd As Long
lnTextStart = InStr(StartPosition, InputText, starttext, vbTextCompare) + Len(starttext)
lnTextEnd = InStr(lnTextStart, InputText, endtext, vbTextCompare)
If lnTextStart >= (StartPosition + Len(starttext)) And lnTextEnd > lnTextStart Then
GetStringBetween = Mid$(InputText, lnTextStart, lnTextEnd - lnTextStart)
Else
GetStringBetween = "ERROR"
End If
End Function
Dim xa As String
Dim x As String = WebBrowser1.DocumentText
用法
xa = GetStringBetween(x, TextBox1.Text, TextBox2.Text)
MsgBox(xa)
我尝试了许多不同的方法来尝试获取其他 2 个字符串之间的所有字符串,每个等该站点有超过 1 个字符串与这 2 个字符串,但我只是得到 2 个字符串之间的第一个字符串帮助抱歉,它很难解释:/