当前位置: 网学 > 编程文档 > VB > 正文

vb将汉字转换为拼音

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/16
下载{$ArticleTitle}原创论文样式
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.感谢你,很有耐心的看完我罗嗦,如果你能完善,请告诉我,谢谢。

 

  • 下一篇资讯: VB 发送邮件
  • 网学推荐

    免费论文

    原创论文

    浏览:
    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    湘ICP备09003080号