Option Explicit
‘在窗口中加两个TEXT控件,一个输入中文,一个显示英文
Private Sub Form_Load()
Text1.Text = "我是中国人"
End Sub
Private Sub Command1_Click()
Text2.Text = GetPY(Text1.Text)
End Sub
‘获得输入名称的首字拼音
Private Function GetPY(ByVal strParmeter As String) As String
Dim intTmp As String, i As Long
For i = 1 To Len(strParmeter)
intTmp = Asc(Mid(strParmeter, i, 1))
If intTmp < Asc("啊") Then
GetPY = GetPY & "*"
ElseIf intTmp >= Asc("啊") And intTmp < Asc("芭") Then
GetPY = GetPY & "A"
ElseIf intTmp >= Asc("芭") And intTmp < Asc("擦") Then
GetPY = GetPY & "B"
ElseIf intTmp >= Asc("擦") And intTmp < Asc("搭") Then
GetPY = GetPY & "C"
ElseIf intTmp >= Asc("搭") And intTmp < Asc("蛾") Then
GetPY = GetPY & "D"
ElseIf intTmp >= Asc("蛾") And intTmp < Asc("发") Then
GetPY = GetPY & "E"
ElseIf intTmp >= Asc("发") And intTmp < Asc("噶") Then
GetPY = GetPY & "F"
ElseIf intTmp >= Asc("噶") And intTmp < Asc("哈") Then
GetPY = GetPY & "G"
ElseIf intTmp >= Asc("哈") And intTm
游客
非常好 2009-11-22