汉字转拼音缩写的函数(VB)

1093人阅读 评论(0) 收藏 举报

汉字转拼音缩写的函数(VB)

出处:不详
Public Function getPYChar(char As String) As String
Dim lChar As Long
lChar = 65536 + Asc(char)
If (lChar >= 45217 And lChar <= 45252) Then getPYChar = "A"
If (lChar >= 45253 And lChar <= 45760) Then getPYChar = "B"
If (lChar >= 47761 And lChar <= 46317) Then getPYChar = "C"
If (lChar >= 46318 And lChar <= 46825) Then getPYChar = "D"
If (lChar >= 46826 And lChar <= 47009) Then getPYChar = "E"
If (lChar >= 47010 And lChar <= 47296) Then getPYChar = "F"
If (lChar >= 47297 And lChar <= 47613) Then getPYChar = "G"
If (lChar >= 47614 And lChar <= 48118) Then getPYChar = "H"
If (lChar >= 48119 And lChar <= 49061) Then getPYChar = "J"
If (lChar >= 49062 And lChar <= 49323) Then getPYChar = "K"
If (lChar >= 49324 And lChar <= 49895) Then getPYChar = "L"
If (lChar >= 49896 And lChar <= 50370) Then getPYChar = "M"
If (lChar >= 50371 And lChar <= 50613) Then getPYChar = "N"
If (lChar >= 50614 And lChar <= 50621) Then getPYChar = "O"
If (lChar >= 50622 And lChar <= 50905) Then getPYChar = "P"
If (lChar >= 50906 And lChar <= 51386) Then getPYChar = "Q"
If (lChar >= 51387 And lChar <= 51445) Then getPYChar = "R"
If (lChar >= 51446 And lChar <= 52217) Then getPYChar = "S"
If (lChar >= 52218 And lChar <= 52697) Then getPYChar = "T"
If (lChar >= 52698 And lChar <= 52979) Then getPYChar = "W"
If (lChar >= 52980 And lChar <= 53640) Then getPYChar = "X"
If (lChar >= 53689 And lChar <= 54480) Then getPYChar = "Y"
If (lChar >= 54481 And lChar <= 52289) Then getPYChar = "Z"
End Function

Public Function getPY(str As String) As String
For i = 0 To Len(str) - 1
getPY = getPY & getPYChar(Mid(str, i + 1, 1))
Next
End Function 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1135420次
    • 积分:15949
    • 等级:
    • 排名:第652名
    • 原创:268篇
    • 转载:815篇
    • 译文:17篇
    • 评论:59条
    友情链接
    最新评论