t;, -11077
objPinYinDic.Add "yun", -11067
objPinYinDic.Add "za", -11055
objPinYinDic.Add "zai", -11052
objPinYinDic.Add "zan", -11045
objPinYinDic.Add "zang", -11041
objPinYinDic.Add "zao", -11038
objPinYinDic.Add "ze", -11024
objPinYinDic.Add "zei", -11020
objPinYinDic.Add "zen", -11019
objPinYinDic.Add "zeng", -11018
objPinYinDic.Add "zha", -11014
objPinYinDic.Add "zhai", -10838
objPinYinDic.Add "zhan", -10832
objPinYinDic.Add "zhang", -10815
objPinYinDic.Add "zhao", -10800
objPinYinDic.Add "zhe", -10790
objPinYinDic.Add "zhen", -10780
objPinYinDic.Add "zheng", -10764
objPinYinDic.Add "zhi", -10587
objPinYinDic.Add "zhong", -10544
objPinYinDic.Add "zhou", -10533
objPinYinDic.Add "zhu", -10519
objPinYinDic.Add "zhua", -10331
objPinYinDic.Add "zhuai", -10329
objPinYinDic.Add "zhuan", -10328
objPinYinDic.Add "zhuang", -10322
objPinYinDic.Add "zhui", -10315
objPinYinDic.Add "zhun", -10309
objPinYinDic.Add "zhuo", -10307
objPinYinDic.Add "zi", -10296
objPinYinDic.Add "zong", -10281
objPinYinDic.Add "zou", -10274
objPinYinDic.Add "zu", -10270
objPinYinDic.Add "zuan", -10262
objPinYinDic.Add "zui", -10260
objPinYinDic.Add "zun", -10256
objPinYinDic.Add "zuo", -10254
Dim arrPinYin As Variant
Dim arrPinYinCode As Variant
Dim i As Integer
Dim intIndex As Integer
Dim intHanZiAsc As Integer
Dim strResult As String
strResult = ""
For intIndex = 1 To Len(strHanZi)
intHanZiAsc = Asc(Mid(strHanZi, intIndex, 1))
If intHanZiAsc > 0 And intHanZiAsc < 160 Then
strResult = Chr(intHanZiAsc)
Else
If intHanZiAsc < -20319 Or intHanZiAsc > -10247 Then
strResult = strResult & ""
Else
arrPinYin = objPinYinDic.Items
arrPinYinCode = objPinYinDic.Keys
For i = objPinYinDic.Count - 1 To 0 Step -1
If arrPinYin(i) <= intHanZiAsc Then Exit For
Next
If i >= LBound(arrPinYin) And i <= UBound(arrPinYin) Then ''''防止越界
strResult = strResult & arrPinYinCode(i)
Else
strResult = strResult & ""
End If
End If
End If
Next
gGetPinYin = strResult
End Function
问题有很多,我只是随便弄了一下,以后再修改
1.空字符串没有处理
2.标点符号没有处理
3.不支持只输出首字母
4.多音字无法分辩
5.字典难以维护,错了一个很难查出来,等我重新想个办法
6.先好好的弄懂,拼音的编码原理,再弄懂汉字的编码原理
7.感谢你,很有耐心的看完我罗嗦,如果你能完善,请告诉我,谢谢。