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

包含数据库的ASP汉字转拼音的程序源码

自己写的ASP汉字转拼音的程序,支持部分不常见汉字的拼音。更多不常见汉字的拼音正在整理中,更新地址:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'=====================================================================
'  意见反馈地址: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
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,