中文字符串拼音首字母串的函数
有时候网站需要把中文字符串转换成拼音,下面这段函数就是实现此功能
function getpinyinchar(char)
tmp=65536+asc(char)
if(tmp>=45217 and tmp<=45252) then
getpinyinchar= "A"
elseif(tmp>=45253 and tmp<=45760) then
getpinyinchar= "B"
elseif(tmp>=45761 and tmp<=46317) then
getpinyinchar= "C"
elseif(tmp>=46318 and tmp<=46825) then
getpinyinchar= "D"
elseif(tmp>=46826 and tmp<=47009) then
getpinyinchar= "E"
elseif(tmp>=47010 and tmp<=47296) then
getpinyinchar= "F"
elseif(tmp>=47297 and tmp<=47613) then
getpinyinchar= "G"
elseif(tmp>=47614 and tmp<=48118) then
getpinyinchar= "H"
elseif(tmp>=48119 and tmp<=49061) then
getpinyinchar= "J"
elseif(tmp>=49062 and tmp<=49323) then
getpinyinchar= "K"
elseif(tmp>=49324 and tmp<=49895) then
getpinyinchar= "L"
elseif(tmp>=49896 and tmp<=50370) then
getpinyinchar= "M"
elseif(tmp>=50371 and tmp<=50613) then
getpinyinchar= "N"
elseif(tmp>=50614 and tmp<=50621) then
getpinyinchar= "O"
elseif(tmp>=50622 and tmp<=50905) then
getpinyinchar= "P"
elseif(tmp>=50906 and tmp<=51386) then
getpinyinchar= "Q"
elseif(tmp>=51387 and tmp<=51445) then
getpinyinchar= "R"
elseif(tmp>=51446 and tmp<=52217) then
getpinyinchar= "S"
elseif(tmp>=52218 and tmp<=52697) then
getpinyinchar= "T"
elseif(tmp>=52698 and tmp<=52979) then
getpinyinchar= "W"
elseif(tmp>=52980 and tmp<=53640) then
getpinyinchar= "X"
elseif(tmp>=53689 and tmp<=54480) then
getpinyinchar= "Y"
elseif(tmp>=54481 and tmp<=62289) then
getpinyinchar= "Z"
else '如果不是中文,则不处理
getpinyinchar=char
end if
end function
function getpinyin(str)
for i=1 to len(str)
getpinyin=getpinyin&getpinyinchar(mid(str,i,1))
next
end function
response.write getpinyin(content)&chr(10)'调用方式