Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Dim 字符串 As String = Replace(TextBox1.Text, "ng", "")
Dim 截取长度 As Integer = 1
Dim 二字声母字符串() As String = {"zh", "ch", "sh"}
Dim 单字声母字符串() As String = {"b", "p", "m", "f", "d", "t", "n", "l", "g", "k", "h", "j", "q", "x", "z", "c", "s", "r", "y", "w"}
Dim 三字韵母字符串() As String = {"ang", "eng", "ing", "ong"}
Dim 二字韵母字符串() As String = {"ai ", "ei ", "ui ", "ao ", "ou", " iu ", "ie", " ve", " er ", "an ", "en ", "in ", "un ", "vn"}
Dim 单字韵母字符串() As String = {"a", "o", "e", "i", "u", "v"} ' a an ang e en eng i in ing o on u un v vn
Dim 声母 As String = "bpmfdtnlgkhjqxzcsryw"
Dim 韵母 As String = "aoeiuv"
Dim 按键码 As Integer = e.KeyCode
If InStr(Chr(按键码), 声母) > 0 Then
TextBox2.Text = TextBox2.Text & "韵母:" & Chr(按键码) & vbCrLf
ElseIf InStr(Chr(按键码), 韵母) > 0 Then
TextBox2.Text = TextBox2.Text & "韵母:" & Chr(按键码) & vbCrLf
Else
TextBox2.Text = TextBox2.Text & "其他:" & Chr(按键码) & vbCrLf
End If
'得到各 声母 和 韵母 的位置 Mid(字符串, 开始位置, 截取长度) InStr(二字声母字符串(x), 字符串)
End Sub