汉字转拼音程序问题

chi0591 2007-09-15 11:02:14
以下是从网络上找到的程序,对于大部分汉字都可以,不知道为什么"榕"字却返回了Z
真奇怪,有朋友知道吗?或者提供一个正确的转换函数..

'获取汉字拼音第一字母
function getpychar(char)
dim tmp
tmp=65536+asc(char)
if(tmp> =45217 and tmp <=45252) then
getpychar= "A"
elseif(tmp> =45253 and tmp <=45760) then
getpychar= "B"
elseif(tmp> =45761 and tmp <=46317) then
getpychar= "C"
elseif(tmp> =46318 and tmp <=46825) then
getpychar= "D"
elseif(tmp> =46826 and tmp <=47009) then
getpychar= "E"
elseif(tmp> =47010 and tmp <=47296) then
getpychar= "F"
elseif(tmp> =47297 and tmp <=47613) then
getpychar= "G"
elseif(tmp> =47614 and tmp <=48118) then
getpychar= "H"
elseif(tmp> =48119 and tmp <=49061) then
getpychar= "J"
elseif(tmp> =49062 and tmp <=49323) then
getpychar= "K"
elseif(tmp> =49324 and tmp <=49895) then
getpychar= "L"
elseif(tmp> =49896 and tmp <=50370) then
getpychar= "M"
elseif(tmp> =50371 and tmp <=50613) then
getpychar= "N"
elseif(tmp> =50614 and tmp <=50621) then
getpychar= "O"
elseif(tmp> =50622 and tmp <=50905) then
getpychar= "P"
elseif(tmp> =50906 and tmp <=51386) then
getpychar= "Q"
elseif(tmp> =51387 and tmp <=51445) then
getpychar= "R"
elseif(tmp> =51446 and tmp <=52217) then
getpychar= "S"
elseif(tmp> =52218 and tmp <=52697) then
getpychar= "T"
elseif(tmp> =52698 and tmp <=52979) then
getpychar= "W"
elseif(tmp> =52980 and tmp <=53688) then
getpychar= "X"
elseif(tmp> =53689 and tmp <=54480) then
getpychar= "Y"
elseif(tmp> =54481 and tmp <=62289) then
getpychar= "Z"
else '如果不是中文,则不处理
getpychar=char
end if
end function
...全文
124 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangtomi 2007-12-27
  • 打赏
  • 举报
回复
我也想知道啊。老大们多说几句吧。
chi0591 2007-09-17
  • 打赏
  • 举报
回复
谢谢楼上两位,不知道还有其他方法吗?
因为使用客户端处理我程序需要修改很多。.
xuStanly 2007-09-15
  • 打赏
  • 举报
回复
http://blog.csdn.net/xuStanly/archive/2007/08/28/1761397.aspx
用这个,还不错。
除了多音字实在没办法外,其他的都对。
cime63 2007-09-15
  • 打赏
  • 举报
回复
有部分汉字是不符合这个规则的.

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧