帐号: 密码:
// 设为首页 // 收藏本站 // 请您留言 // 网址导航
远方教程-满足你的求知欲!
站内搜索:
HTML ASP PHP CSS DIV Dreamweaver Photoshop Word Excel PPT SEO技巧
您当前位置:网站首页 >> ASP教程 >> ASP优化技巧 >> 阅读文章

ASP从汉字中提取出拼音首字母的方法

来源:远方教程 作者:远方教程 发布时间:2015-02-24 查看次数:3549 访问[新版]

    想做一个利用拼音的检索程序,还没想出来,但是却无意间实现了怎样从汉字中获取拼音首字母的程序,分享给大家。

<%
'返回汉字拼音首字母串
Function getpychar(char)
getpychar = ""
Dim charLen,chrInt,tmpp,pychar
charLen = Len(char)
If charLen < 1 Then Exit Function
For chrInt = 1 To charLen
tmpp=65536+asc(Mid(char,chrInt,1))
If(tmpp>=45217 And tmpp<=45252) Then
 pychar= "A"
ElseIf(tmpp>=45253 And tmpp<=45760) Then
 pychar= "B"
ElseIf(tmpp>=45761 And tmpp<=46317) Then
 pychar= "C"
ElseIf(tmpp>=46318 And tmpp<=46825) Then
 pychar= "D"
ElseIf(tmpp>=46826 And tmpp<=47009) Then
 pychar= "E"
ElseIf(tmpp>=47010 And tmpp<=47296) Then
 pychar= "F"
ElseIf(tmpp>=47297 And tmpp<=47613) Then
 pychar= "G"
ElseIf(tmpp>=47614 And tmpp<=48118) Then
 pychar= "H"
ElseIf(tmpp>=48119 And tmpp<=49061) Then
 pychar= "J"
ElseIf(tmpp>=49062 And tmpp<=49323) Then
 pychar= "K"
ElseIf(tmpp>=49324 And tmpp<=49895) Then
 pychar= "L"
ElseIf(tmpp>=49896 And tmpp<=50370) Then
 pychar= "M"
ElseIf(tmpp>=50371 And tmpp<=50613) Then
 pychar= "N"
ElseIf(tmpp>=50614 And tmpp<=50621) Then
 pychar= "O"
ElseIf(tmpp>=50622 And tmpp<=50905) Then
 pychar= "P"
ElseIf(tmpp>=50906 And tmpp<=51386) Then
 pychar= "Q"
ElseIf(tmpp>=51387 And tmpp<=51445) Then
 pychar= "R"
ElseIf(tmpp>=51446 And tmpp<=52217) Then
 pychar= "S"
ElseIf(tmpp>=52218 And tmpp<=52697) Then
 pychar= "T"
ElseIf(tmpp>=52698 And tmpp<=52979) Then
 pychar= "W"
ElseIf(tmpp>=52980 And tmpp<=53640) Then
 pychar= "X"
ElseIf(tmpp>=53689 And tmpp<=54480) Then
 pychar= "Y"
ElseIf(tmpp>=54481 And tmpp<=62289) Then
 pychar= "Z"
Else '如果不是中文,则不处理
 pychar= Mid(char,chrInt,1)
End If
getpychar = getpychar & pychar
Next
End function
%>

打印 打印 | 关闭 关闭 评论
相关文章
图片新闻
站内搜索  
搜索
猜您喜欢  
最新更新  
阅读排行  
关于我们 | 联系方式 | 大事记 | 免责声明 | | 给我留言
部分广告源自金山联盟2345联盟 QQ咨询 站长之家QQ群:232617873
Copyright 2024 远方教程 © All Rights Reserved.

回顶部