CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
英特尔®游戏设计大赛100美元现金周周送 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  基础类

哪位大侠能用vb求出汉字的拼音码来,请告诉我,在下不胜感激。

楼主zhangquanan()2003-11-03 10:41:04 在 VB / 基础类 提问

哪位大侠能用vb求出汉字的拼音码来,请告诉我,在下不胜感激。    
  例如:汉字“北京”,它的拼音码为“bj”    
  "河北省",它的拼音码为“hbs”。  
   
  问题点数:0、回复次数:2Top

1 楼cuizm(射天狼 http://www.j2soft.cn/)回复于 2003-11-03 11:03:10 得分 0

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   intTmp   <   Asc("击")   Then  
                          GetPY   =   GetPY   &   "H"  
                  ElseIf   intTmp   >=   Asc("击")   And   intTmp   <   Asc("喀")   Then  
                          GetPY   =   GetPY   &   "J"  
                  ElseIf   intTmp   >=   Asc("喀")   And   intTmp   <   Asc("垃")   Then  
                          GetPY   =   GetPY   &   "K"  
                  ElseIf   intTmp   >=   Asc("垃")   And   intTmp   <   Asc("妈")   Then  
                          GetPY   =   GetPY   &   "L"  
                  ElseIf   intTmp   >=   Asc("妈")   And   intTmp   <   Asc("拿")   Then  
                          GetPY   =   GetPY   &   "M"  
                  ElseIf   intTmp   >=   Asc("拿")   And   intTmp   <   Asc("哦")   Then  
                          GetPY   =   GetPY   &   "N"  
                  ElseIf   intTmp   >=   Asc("哦")   And   intTmp   <   Asc("啪")   Then  
                          GetPY   =   GetPY   &   "O"  
                  ElseIf   intTmp   >=   Asc("啪")   And   intTmp   <   Asc("期")   Then  
                          GetPY   =   GetPY   &   "P"  
                  ElseIf   intTmp   >=   Asc("期")   And   intTmp   <   Asc("然")   Then  
                          GetPY   =   GetPY   &   "Q"  
                  ElseIf   intTmp   >=   Asc("然")   And   intTmp   <   Asc("撒")   Then  
                          GetPY   =   GetPY   &   "R"  
                  ElseIf   intTmp   >=   Asc("撒")   And   intTmp   <   Asc("塌")   Then  
                          GetPY   =   GetPY   &   "S"  
                  ElseIf   intTmp   >=   Asc("塌")   And   intTmp   <   Asc("挖")   Then  
                          GetPY   =   GetPY   &   "T"  
                  ElseIf   intTmp   >=   Asc("挖")   And   intTmp   <   Asc("昔")   Then  
                          GetPY   =   GetPY   &   "W"  
                  ElseIf   intTmp   >=   Asc("昔")   And   intTmp   <   Asc("压")   Then  
                          GetPY   =   GetPY   &   "X"  
                  ElseIf   intTmp   >=   Asc("压")   And   intTmp   <   Asc("匝")   Then  
                          GetPY   =   GetPY   &   "Y"  
                  ElseIf   intTmp   >=   Asc("匝")   And   intTmp   <   0   Then  
                          GetPY   =   GetPY   &   "Z"  
                  ElseIf   (intTmp   >=   65   And   intTmp   <=   91)   Or   (intTmp   >=   97   And   intTmp   <=   123)   Then  
                          GetPY   =   GetPY   &   Mid(strParmeter,   i,   1)  
                  Else  
                          GetPY   =   GetPY   &   "*"  
                  End   If  
          Next  
  End   Function  
   
  Top

2 楼yoki(小马哥--鬓微霜,又何妨)回复于 2003-11-03 11:16:10 得分 0

http://expert.csdn.net/Expert/topic/2407/2407438.xml?temp=.8457453Top

相关问题

  • 如何用VB判断汉字的拼音?
  • VB中如何取得汉字拼音首字母
  • 汉字转拼音。。。。
  • 请问在VB中如何根据一个汉字而得到这个汉字的拼音?谁知道...
  • 请问在VB中如何根据一个汉字而得到这个汉字的拼音?谁知道...
  • 提取汉字的拼音
  • 汉字转化为拼音 ?
  • 汉字转换为拼音 ?
  • 如何使VB在数据库中查询得出的汉字按其拼音的字母顺序排序?
  • 我在VB中调用的一个汉字转拼音DLL,怎么在DELPHI中调用这个?

关键词

  • 汉字
  • asc
  • 拼音
  • strparmeter
  • inttmp
  • sub
  • and inttmp
  • text
  • as string

得分解答快速导航

  • 帖主:zhangquanan

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo