在C#中怎么得到汉字的拼音码

Public   Function   HzToSpell(Hz   As   String)   As   String   '生成简拚  
          Dim   slen,   xx   As   Integer  
          Dim   high,   low,   i   As   Long  
          Dim   Ss1,   Ss2   As   String  
          Ss2   =   Hz  
          slen   =   Len(Ss2)  
          If   slen   =   0   Then  
                  HzToSpell   =   ""  
                  Exit   Function  
          End   If  
          For   xx   =   1   To   slen  
                          i   =   65535   +   Asc(Mid(Hz,   xx))   +   1  
                          If   i   >=   45217   And   i   <   45253   Then  
                                  Ss1   =   Ss1   +   "A"  
                          End   If  
                          If   i   >=   45253   And   i   <   45761   Then  
                                  Ss1   =   Ss1   +   "B"  
                          End   If  
                          If   i   >=   45761   And   i   <   46318   Then  
                                  Ss1   =   Ss1   +   "C"  
                          End   If  
                          If   i   >=   46318   And   i   <   46826   Then  
                                  Ss1   =   Ss1   +   "D"  
                          End   If  
                          If   i   >=   46826   And   i   <   47010   Then  
                                  Ss1   =   Ss1   +   "E"  
                          End   If  
                          If   i   >=   47010   And   i   <   47297   Then  
                                  Ss1   =   Ss1   +   "F"  
                          End   If  
                          If   i   >=   47297   And   i   <   47614   Then  
                                  Ss1   =   Ss1   +   "G"  
                          End   If  
                          If   i   >=   47614   And   i   <   48119   Then  
                                  Ss1   =   Ss1   +   "H"  
                          End   If  
                          If   i   >=   48119   And   i   <   49062   Then  
                                  Ss1   =   Ss1   +   "J"  
                          End   If  
                          If   i   >=   49062   And   i   <   49324   Then  
                                  Ss1   =   Ss1   +   "K"  
                          End   If  
                          If   i   >=   49324   And   i   <   49896   Then  
                                  Ss1   =   Ss1   +   "L"  
                          End   If  
                          If   i   >=   49896   And   i   <   50371   Then  
                                  Ss1   =   Ss1   +   "M"  
                          End   If  
                          If   i   >=   50371   And   i   <   50614   Then  
                                  Ss1   =   Ss1   +   "N"  
                          End   If  
                          If   i   >=   50614   And   i   <   50622   Then  
                                  Ss1   =   Ss1   +   "O"  
                          End   If  
                          If   i   >=   50622   And   i   <   50906   Then  
                                  Ss1   =   Ss1   +   "P"  
                          End   If  
                          If   i   >=   50906   And   i   <   51387   Then  
                                  Ss1   =   Ss1   +   "Q"  
                          End   If  
                          If   i   >=   51387   And   i   <   51446   Then  
                                  Ss1   =   Ss1   +   "R"  
                          End   If  
                          If   i   >=   51446   And   i   <   52218   Then  
                                  Ss1   =   Ss1   +   "S"  
                          End   If  
                          If   i   >=   52218   And   i   <   52698   Then  
                                  Ss1   =   Ss1   +   "T"  
                          End   If  
                          If   i   >=   52698   And   i   <   52980   Then  
                                  Ss1   =   Ss1   +   "W"  
                          End   If  
                          If   i   >=   52980   And   i   <   53689   Then  
                                  Ss1   =   Ss1   +   "X"  
                          End   If  
                          If   i   >=   53689   And   i   <   54481   Then  
                                  Ss1   =   Ss1   +   "Y"  
                          End   If  
                          If   i   >=   54481   And   i   <   55290   Then  
                                  Ss1   =   Ss1   +   "Z"  
                          End   If  
                          If   (Asc(Mid(Hz,   xx))   >=   97   And   Asc(Mid(Hz,   xx))   <=   122)   Or   (Asc(Mid(Hz,   xx))   >=   65   And   Asc(Mid(Hz,   xx))   <=   90)   Then  
                                  Ss1   =   Ss1   +   Mid(Hz,   xx,   1)  
                          End   If  
          Next  
          HzToSpell   =   Ss1  
  End   Function   
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值