我正在创建一个函数,允许我在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”......
答案 0 :(得分:0)
dim previousChar as char = ""
For Each ch as Char in HTextDisplay.Text
msgbox ch & " - previous character = " & previousChar
'other processing
previouschar = ch
Next