拼音处理
来源:互联网 发布:Js动态添加button 编辑:程序博客网 时间:2024/04/20 16:20
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
/*-1.-获得汉字字符串的首字母
根据大力的贴子改成.将大力的两个函数合并成了一个函数.
可以应用于助记码的查询
--*/
ifexists(select*fromdbo.sysobjectswhereid=object_id(N'[dbo].[fGetPy]')andxtypein(N'FN',N'IF',N'TF'))
dropfunction[dbo].[fGetPy]
GO
--创建取拼音函数
createfunctionfGetPy(@Strvarchar(500)='')
returnsvarchar(500)
as
begin
declare@strlenint,@returnvarchar(500),@iiint
declare@nint,@cchar(1),@chnnchar(1)
select@strlen=len(@str),@return='',@ii=0
set@ii=0
while@ii<@strlen
begin
select@ii=@ii+1,@n=63,@chn=substring(@str,@ii,1)
if@chn>'z'
select@n=@n+1
,@c=casechnwhen@chnthenchar(@n)else@cend
from(
selecttop27*from(
selectchn='吖'
unionallselect'八'
unionallselect'嚓'
unionallselect'咑'
unionallselect'妸'
unionallselect'发'
unionallselect'旮'
unionallselect'铪'
unionallselect'丌' --becausehaveno'i'
unionallselect'丌'
unionallselect'咔'
unionallselect'垃'
unionallselect'呒'
unionallselect'拏'
unionallselect'噢'
unionallselect'妑'
unionallselect'七'
unionallselect'呥'
unionallselect'仨'
unionallselect'他'
unionallselect'屲' --no'u'
unionallselect'屲' --no'v'
unionallselect'屲'
unionallselect'夕'
unionallselect'丫'
unionallselect'帀'
unionallselect@chn)asa
orderbychnCOLLATEChinese_PRC_CI_AS
)asb
elseset@c='a'
set@return=@return+@c
end
return(@return)
end
go
--测试
selectdbo.fgetpy('东莞市')as东莞市,dbo.fgetpy('ab中c国人')as中国人
--删除拼音函数
dropfunctionfgetpy
/*2.--获得汉字拼音的函数
需要创建一个拼音表,包含所有汉字的发音,这个可以通过转换全拼输入法的编码库得到,这里仅举了一个简单的例子.
--*/
--创建汉字拼音库
createtableYingShe(CHR char(2),PYvarchar(10))
insertYingShe
select'长','chang'
unionallselect'长','zhang'
unionallselect'城','cheng'
unionallselect'科','kel'
unionallselect'技','ji'
unionallselect'金','jin'
unionallselect'立','li'1<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
/*-1.-获得汉字字符串的首字母
根据大力的贴子改成.将大力的两个函数合并成了一个函数.
可以应用于助记码的查询
--*/
ifexists(select*fromdbo.sysobjectswhereid=object_id(N'[dbo].[fGetPy]')andxtypein(N'FN',N'IF',N'TF'))
dropfunction[dbo].[fGetPy]
GO
--创建取拼音函数
createfunctionfGetPy(@Strvarchar(500)='')
returnsvarchar(500)
as
begin
declare@strlenint,@returnvarchar(500),@iiint
declare@nint,@cchar(1),@chnnchar(1)
select@strlen=len(@str),@return='',@ii=0
set@ii=0
while@ii<@strlen
begin
select@ii=@ii+1,@n=63,@chn=substring(@str,@ii,1)
if@chn>'z'
select@n=@n+1
,@c=casechnwhen@chnthenchar(@n)else@cend
from(
selecttop27*from(
selectchn='吖'
unionallselect'八'
unionallselect'嚓'
unionallselect'咑'
unionallselect'妸'
unionallselect'发'
unionallselect'旮'
unionallselect'铪'
unionallselect'丌' --becausehaveno'i'
unionallselect'丌'
unionallselect'咔'
unionallselect'垃'
unionallselect'呒'
unionallselect'拏'
unionallselect'噢'
unionallselect'妑'
unionallselect'七'
unionallselect'呥'
unionallselect'仨'
unionallselect'他'
unionallselect'屲' --no'u'
unionallselect'屲' --no'v'
unionallselect'屲'
unionallselect'夕'
unionallselect'丫'
unionallselect'帀'
unionallselect@chn)asa
orderbychnCOLLATEChinese_PRC_CI_AS
)asb
elseset@c='a'
set@return=@return+@c
end
return(@return)
end
go
--测试
selectdbo.fgetpy('东莞市')as东莞市,dbo.fgetpy('ab中c国人')as中国人
--删除拼音函数
dropfunctionfgetpy
/*2.--获得汉字拼音的函数
需要创建一个拼音表,包含所有汉字的发音,这个可以通过转换全拼输入法的编码库得到,这里仅举了一个简单的例子.
--*/
--创建汉字拼音库
createtableYingShe(CHR char(2),PYvarchar(10))
insertYingShe
select'长','chang'
unionallselect'长','zhang'
unionallselect'城','cheng'
unionallselect'科','kel'
unionallselect'技','ji'
unionallselect'金','jin'
unionallselect'立','li'1<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- 拼音处理
- javascript处理拼音
- 分页查询
- asp.net(c#)access数据库操作类 OleHelper
- 中存/取文件
- 为自己生活还是为他人活
- 用DBMS_DDL包重编译PL/SQL对象
- 拼音处理
- 化解字符串不能超过8000的方法及交叉表的处理
- 备份/恢复方案
- 树形数据的处理
- 在不破坏原加密存储过程的前提下,解密存储过程!(补充j9988)
- DbVisualizer图解
- IPO
- 一个简单的考勤系统
- GCC for Win32开发环境介绍(1)