我正在教科书中工作,他们希望我使用.length,.trim,.remove,.insert,.indexof,.substring,like,is not,and some other。我有这个程序工作直到while循环,它冻结。 是否有另一个运算符查看可以用于我正在尝试执行的模式(或者有没有一种方法可以用来执行此操作)?如果是这样,我该如何使用它?当循环处理时,程序冻结
Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles btnConvert.Click
Dim strWord As String
strWord = txtBefore.Text
If strWord.ToUpper.Substring(0, 1) Like "[A,E,I,O,U]" Then
strWord = strWord.Insert(strWord.Length, "-way")
ElseIf strWord.ToUpper.Contains("A") Or
strWord.ToUpper.Contains("E") Or
strWord.ToUpper.Contains("I") Or
strWord.ToUpper.Contains("O") Or
strWord.ToUpper.Contains("U") Then
strWord = strWord.Insert(strWord.Length, "-")
'works up until the while loop
'program freezes no error
While strWord.ToUpper.Substring(0, 1) IsNot "[A,E,I,O,U,Y]"
Dim strTemp As String
strTemp = strWord.Substring(0, 1)
strWord = strWord.Remove(0, 1)
strWord = strWord.Insert(strWord.Length, strTemp)
End While
strWord = strWord.Insert(strWord.Length, "ay")
End If
'txtAfter.Text = strWord
End Sub
你调试了吗? – OneFineDay
无限循环? – OneFineDay
多数民众赞成在即时通讯思维,只是试过调试它仍然摊位 – 0000