1

我正在尝试使用 textbox1 中的字符串并查找第三个“e”并告诉它的索引,例如,如果有人输入奶酪,那么它的索引

到目前为止,我有

Dim word As String = TextBox2.Text
Dim x As String
Dim counter As Integer
Dim Letter As String
Dim word1 As String
x = 0
word1 = word.ToLower()
Do
    If word1.Substring(x, 1) = "e" Then counter = counter + 1 And x = x + 1
Loop Until counter = 3 Or counter <> 3
If counter <> 3 Then MsgBox("There are only " & counter & "e's in the inputted string") Else ListBox2.Items.Add(Letter)
4

0 回答 0