西安网站建设ASP常用函数:getpy() 汉字转为拼音

9062015-03-30

西安网站建设ASP常用函数:getpy() 汉字转为拼音

<%

'取字段数据每个汉字的拼音首字母

Function getpychar(char)tmp = 65536 + Asc(char)If(tmp>= 45217 And tmp<= 45252) Thengetpychar = "A"ElseIf(tmp>= 45253 And tmp<= 45760) Thengetpychar = "B"ElseIf(tmp>= 47761 And tmp<= 46317) Thengetpychar = "C"ElseIf(tmp>= 46318 And tmp<= 46825) Thengetpychar = "D"ElseIf(tmp>= 46826 And tmp<= 47009) Thengetpychar = "E"ElseIf(tmp>= 47010 And tmp<= 47296) Thengetpychar = "F"ElseIf(tmp>= 47297 And tmp<= 47613) Thengetpychar = "G"ElseIf(tmp>= 47614 And tmp<= 48118) Thengetpychar = "H"ElseIf(tmp>= 48119 And tmp<= 49061) Thengetpychar = "J"ElseIf(tmp>= 49062 And tmp<= 49323) Thengetpychar = "K"ElseIf(tmp>= 49324 And tmp<= 49895) Thengetpychar = "L"ElseIf(tmp>= 49896 And tmp<= 50370) Thengetpychar = "M"ElseIf(tmp>= 50371 And tmp<= 50613) Thengetpychar = "N"ElseIf(tmp>= 50614 And tmp<= 50621) Thengetpychar = "O"ElseIf(tmp>= 50622 And tmp<= 50905) Thengetpychar = "P"ElseIf(tmp>= 50906 And tmp<= 51386) Thengetpychar = "Q"ElseIf(tmp>= 51387 And tmp<= 51445) Thengetpychar = "R"ElseIf(tmp>= 51446 And tmp<= 52217) Thengetpychar = "S"ElseIf(tmp>= 52218 And tmp<= 52697) Thengetpychar = "T"ElseIf(tmp>= 52698 And tmp<= 52979) Thengetpychar = "W"ElseIf(tmp>= 52980 And tmp<= 53640) Thengetpychar = "X"ElseIf(tmp>= 53689 And tmp<= 54480) Thengetpychar = "Y"ElseIf(tmp>= 54481 And tmp<= 62289) Thengetpychar = "Z"Else '如果不是中文,则不处理getpychar = char

End If

End Function

Function getpy(Str)For i = 1 To Len(Str)getpy = getpy&getpychar(Mid(Str, i, 1))Next

End Function

%>

程序代码

<%

'取字段数据每个汉字的拼音首字母

Function getpychar(char)tmp = 65536 + Asc(char)If(tmp>= 45217 And tmp<= 45252) Thengetpychar = "A"ElseIf(tmp>= 45253 And tmp<= 45760) Thengetpychar = "B"ElseIf(tmp>= 47761 And tmp<= 46317) Thengetpychar = "C"ElseIf(tmp>= 46318 And tmp<= 46825) Thengetpychar = "D"ElseIf(tmp>= 46826 And tmp<= 47009) Thengetpychar = "E"ElseIf(tmp>= 47010 And tmp<= 47296) Thengetpychar = "F"ElseIf(tmp>= 47297 And tmp<= 47613) Thengetpychar = "G"ElseIf(tmp>= 47614 And tmp<= 48118) Thengetpychar = "H"ElseIf(tmp>= 48119 And tmp<= 49061) Thengetpychar = "J"ElseIf(tmp>= 49062 And tmp<= 49323) Thengetpychar = "K"ElseIf(tmp>= 49324 And tmp<= 49895) Thengetpychar = "L"ElseIf(tmp>= 49896 And tmp<= 50370) Thengetpychar = "M"ElseIf(tmp>= 50371 And tmp<= 50613) Thengetpychar = "N"ElseIf(tmp>= 50614 And tmp<= 50621) Thengetpychar = "O"ElseIf(tmp>= 50622 And tmp<= 50905) Thengetpychar = "P"ElseIf(tmp>= 50906 And tmp<= 51386) Thengetpychar = "Q"ElseIf(tmp>= 51387 And tmp<= 51445) Thengetpychar = "R"ElseIf(tmp>= 51446 And tmp<= 52217) Thengetpychar = "S"ElseIf(tmp>= 52218 And tmp<= 52697) Thengetpychar = "T"ElseIf(tmp>= 52698 And tmp<= 52979) Thengetpychar = "W"ElseIf(tmp>= 52980 And tmp<= 53640) Thengetpychar = "X"ElseIf(tmp>= 53689 And tmp<= 54480) Thengetpychar = "Y"ElseIf(tmp>= 54481 And tmp<= 62289) Thengetpychar = "Z"Else '如果不是中文,则不处理getpychar = char

End If

End Function

Function getpy(Str)For i = 1 To Len(Str)getpy = getpy&getpychar(Mid(Str, i, 1))Next

End Function

%>

通过本文您对西安网站建设有了进一步了解,本公司温馨提醒:找西安做网站公司,请选择手续齐全、业务精、服务好的正规公司。

工商网上亮照

版权所有:西安点墨网络科技有限公司 信息备案编号: 陕ICP备11004160号-1

客户服务电话:029-89640155 18991365125

公司地址:西安市雁塔区朱雀大街紫郡长安F3

Sitemap 网站地图 手机版

办公电话:029-89640155

服务热线:18991365125

客服信箱:vip@dianmo.cc

846461336327

西安点墨网络科技有限公司

版权所有:西安点墨网络科技有限公司 信息备案编号: 陕ICP备11004160号-1