vb.net解决:编一个程序,定义一个字符串变量,输入字符串,然后再输入一个字符,在字符串中查找该字符出现

求解啊

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b As String, c As Integer
a = InputBox("input a string", , "abcdefg")
b = InputBox("find string", , "g")
c = a.IndexOf(b) + 1
MsgBox(c)
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-07-14
用函数Instr(StringA,StringB)来实现
例如:
StringA=“7654321”
StringB=“2”
Instr(StringA,StringB)=6
相似回答