0

我正在创建一个函数,它允许我在 for 循环期间获取字符串中的前一个字符。

Private Sub TSButton_Click(sender As Object, e As EventArgs) Handles TSButton.Click
    For Each ch As Char In HTextDisplay.Text
        MsgBox("the previous characters here")
        'carry out function here
    Next
End Sub

所以如果HTextDisplay.Text是“ABCDEFG”那么msgbox将显示“A”然后“B”然后“C”.....

另一方面,如果我可以检查for循环函数中字符后面是否有字符,我可能会更好

4

1 回答 1

0
dim previousChar as char = ""
For Each ch as Char in HTextDisplay.Text
    msgbox ch & " - previous character = " & previousChar
    'other processing
    previouschar = ch
Next
于 2013-08-08T17:16:32.340 回答