VB中如何实现自动生成拼音码

VB中如何实现自动生成拼音码,最好有例子... VB中如何实现自动生成拼音码,最好有例子 展开
 我来答
匿名用户
2013-06-02
展开全部
汉字转拼音缩写的函数(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
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式