我自己原来写了一拼音生成代码,办法蠢笨,速度也慢,不过在没有看到老猫咪咪的拼音生成器前,也只能将就用了,下面是代码,博大家一笑而已!
'生成拼音--自己编的,不正宗
Public Sub scpy(ByVal str As String, py As String, sm As String)
'str:待生成拼音的字符窜,py:生成拼音的变量,sm:生成拼音首字母的变量
Dim i As Integer, j As Integer
Dim strsql As String, pybe As String, smbe As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.ActiveConnection = CurrentProject.Connection
py = ""
sm = ""
j = Len(str)
If j > 0 Then
For i = 1 To j
strsql = Mid(str, i, 1)
'下面是sql语句,py是一个有13366条记录的表,有汉字hz字段和拼音py字段,是利用拼音输入法导出的,然后删除其中的词组和同音字
trsql = "select py from py where hz = '" & strsql & "';"
rs.Open strsql
If rs.BOF = False And rs.EOF = False Then
pybe = rs.Fields("py")
smbe = Left(pybe, 1)
Else
MsgBox "不认识"
End If
py = py + pybe
sm = sm + smbe
rs.Close
Next i
End If
Set rs = Nothing
Exit Sub
[此贴子已经被作者于2007-4-21 22:34:29编辑过]
|