我已经尝试了很多次,虽然我可以创建代码,使其能够用于诸如“find”或“else”之类的单词,但我无法使其适用于以两个或多个辅音开头的单词. 我的具体问题是有没有一种方法可以让程序搜索 a、i、o、u 或 e 之一?那么我可以请求他们使用的第一个实例的位置,使用 IndexOf + Substring 来完成问题。
到目前为止,我的代码是:-
Private Sub btnCompute_Click(sender As System.Object, e As System.EventArgs) Handles btnCompute.Click
Dim word As String = CStr(txtInput.Text)
Dim first_letter As String = word.Substring(0, 1)
Const vovel As String = "aeiouy"
Const constants As String = "bcdfjklmnopqrstvwxz"
Dim find As String = word.Substring(0, vovel)
Dim delete As String = word.Substring(vovel, constants)
If vovel.Contains(first_letter) Then
txtResults.Text = txtInput.Text & "way"
ElseIf constants.Contains(first_letter) Then
txtResults.Text = delete & find & "ay"
End If
End Sub
结束类
任何帮助或建议将不胜感激