发布网友 发布时间:2022-04-24 14:25
共1个回答
热心网友 时间:2023-08-02 16:39
建议转换成数据库
也可以 '需要代码请Q:58507961
Dim Pos As Long
Dim aru As Long
Dim 字() As String
Dim 拼音() As String
Public Function GetPY(ByVal 汉字 As String) As String
'查找
GetPY = ""
For i = 1 To Pos
If 汉字 = 字(i) Then
GetPY = 拼音(i)
Exit For
End If
Next i
End Function
Private Sub Command1_Click()
'测试
MsgBox GetPY(Text1.Text)
End Sub
Public Function LoadPYLIB()
'加载字库
aru = 1024
ReDim Preserve 字(1 To aru)
ReDim Preserve 拼音(1 To aru)
Open "e:\wdpy.txt" For Input As 1
Do Until EOF(1)
Line Input #1, tmp
a% = InStr(1, tmp, "|")
If a% > 0 Then
l% = Len(tmp) '串长
Pos = Pos + 1
字(Pos) = Left(tmp, a% - 1)
拼音(Pos) = Right(tmp, l% - a%)
If Pos = aru Then
aru = aru + 1024
ReDim Preserve 字(1 To aru)
ReDim Preserve 拼音(1 To aru)
End If
End If
Loop
Close 1
End Function
'需要代码请Q:58507961