我想在其他两个字符串之间找到未指定的字符串

问题描述 投票:-2回答:1

示例:

[按钮单击]两个指定的字符串(<title>[...]</title>)Msgbox(未指定字符串的名称(两个标题标签之间的字符串))

因为标签之间的字符串是可变的,所以我不能使用(if textbox1.contains("EXAMPLE") = true Then [...])

vb.net vb.net-2010
1个回答
0
投票

根据@Jimi的评论

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Dim s = "<title>Hello World</title>"
    Dim startIndex = s.IndexOf(">") + 1
    Dim stringLength = s.LastIndexOf("<") - startIndex
    Dim titleText = s.Substring(startIndex, stringLength)
    Debug.Print(titleText)
End Sub

立即显示窗口

Hello World

© www.soinside.com 2019 - 2024. All rights reserved.