在vb中text1中有"...tasdldjffhhkkghfgy...(表示很多字符)".

Private Sub Command1_Click()

Dim a As Long, b As Long, nStr As String

'得到以S开头的两个字符:

a = InStr(Text1.Text, "s")

If a > 0 Then

nStr = Mid(Text1.Text, 2)

MsgBox "以S开头的两个字符=" & nStr

End If

'得到d和h之间的字符:

a = InStr(Text1.Text, "d")

b = InStr(a + 1, Text1.Text, "h")

If a > 0 And b > 0 Then

nStr = Mid(Text1.Text, a + 1, b - a - 1)

MsgBox "d和h之间的字符=" & nStr

End If

End Sub