包含数据库的ASP汉字转拼音的程序源码
自己写的ASP汉字转拼音的程序,支持部分不常见汉字的拼音。更多不常见汉字的拼音正在整理中,更新地址:
12345678910111213141516171819202122232425262728293031323334353637'=====================================================================
' 意见反馈地址:http://www.miaoqiyuan.cn/p/asp-pinyin
' 最新数据库:http://www.zzzyk.com/upload/20121109/pinyin.db.zip
' http://www.miaoqiyuan.cn/product/update/pinyin.db.rar'=====================================================================
'函数名:GET_PINYIN
' 功能:返回拼音
' 参数:word - 要转换的汉字,只支持一个汉字
Function
GET_PINYIN(word)
if asc(word) > 0 and asc(word) < 128 then
GET_PINYIN = word
exit function
end if
if word =
","
or word =
"。"
or word =
"、"
or word =
"’"
or word =
"‘"
or word =
"“"
or word =
"”"
or word =
":"
then
GET_PINYIN = word
exit function
end if
set pydb = server.createobject(
"ADODB.Connection"
)
pydb.open
"provider=microsoft.jet.oledb.4.0;data source="
& Server.Mappath(
"py.db"
)
set pyrs = pydb.execute(
"select pinyin from PinYin where content like '%"
& word &
"%'"
)
if pyrs.eof then
GET_PINYIN =
"__"
else
GET_PINYIN = pyrs(0)
end if
pyrs.close
set pyrs = nothing
pydb.close
set pydb = nothing
End
Function
dim str,tmp
str =
"猫七,一个不知名程序员,博客地址是:http://www.miaoqiyuan.cn/"
tmp =
""
for i = 1 to len(str)
tmp = tmp & mid(str,i,1)
next
response.write tmp