当前位置:编程学习 > asp >>

用字典提取汉语的拼音的首字母

答案:<%
function getpychar(char)
tmp=65536+asc(char)
if(tmp>=45217 and tmp<=45252) or left(char,1)="a" or left(char,1)="A" then getpychar= "A"
if(tmp>=45253 and tmp<=45760) or left(char,1)="b" or left(char,1)="B" then getpychar= "B"
if(tmp>=45761 and tmp<=46317) or left(char,1)="c" or left(char,1)="C" then getpychar= "C"
if(tmp>=46318 and tmp<=46825) or left(char,1)="d" or left(char,1)="D" then getpychar= "D"
if(tmp>=46826 and tmp<=47009) or left(char,1)="e" or left(char,1)="E" then getpychar= "E"
if(tmp>=47010 and tmp<=47296) or left(char,1)="f" or left(char,1)="F" then getpychar= "F"
if(tmp>=47297 and tmp<=47613) or left(char,1)="g" or left(char,1)="G" then getpychar= "G"
if(tmp>=47614 and tmp<=48118) or left(char,1)="h" or left(char,1)="H" then getpychar= "H"
if left(char,1)="I" or left(char,1)="i" then getpychar= "I"
if(tmp>=48119 and tmp<=49061) or left(char,1)="j" or left(char,1)="J" then getpychar= "J"
if(tmp>=49062 and tmp<=49323) or left(char,1)="k" or left(char,1)="K" then getpychar= "K"
if(tmp>=49324 and tmp<=49895) or left(char,1)="l" or left(char,1)="L" then getpychar= "L"
if(tmp>=49896 and tmp<=50370) or left(char,1)="m" or left(char,1)="M" then getpychar= "M"
if(tmp>=50371 and tmp<=50613) or left(char,1)="n" or left(char,1)="N" then getpychar= "N"
if(tmp>=50614 and tmp<=50621) or left(char,1)="o" or left(char,1)="O" then getpychar= "O"
if(tmp>=50622 and tmp<=50905) or left(char,1)="p" or left(char,1)="P" then getpychar= "P"
if(tmp>=50906 and tmp<=51386) or left(char,1)="q" or left(char,1)="Q" then getpychar= "Q"
if(tmp>=51387 and tmp<=51445) or left(char,1)="r" or left(char,1)="R" then getpychar= "R"
if(tmp>=51446 and tmp<=52217) or left(char,1)="s" or left(char,1)="S" then getpychar= "S"
if(tmp>=52218 and tmp<=52697) or left(char,1)="t" or left(char,1)="T" then getpychar= "T"
if left(char,1)="u" or left(char,1)="U" then getpychar= "U"
if left(char,1)="V" or left(char,1)="v" then getpychar= "V"
if(tmp>=52698 and tmp<=52979) or left(char,1)="w" or left(char,1)="W" then getpychar= "W"
if(tmp>=52980 and tmp<=53640) or left(char,1)="x" or left(char,1)="X" then getpychar= "X"
if(tmp>=53689 and tmp<=54480) or left(char,1)="y" or left(char,1)="Y" then getpychar= "Y"
if(tmp>=54481 and tmp<=55289) or left(char,1)="z" or left(char,1)="Z" then getpychar= "Z"
end function

function getpy(str)
for i=1 to len(str)
getpy=getpy&getpychar(mid(str,i,1))
next
end function
%>

上一个:一份ASP学习笔记(连载二)
下一个:IIS6.0的设置

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,