判断汉字的笔画数
来源:互联网 发布:textarea sql注入 编辑:程序博客网 时间:2024/04/28 20:55
create function fun_getbh(@str nvarchar(4000))
returns int
as
begin
declare @word nchar(1),@n int
set @n=0
while len(@str)>0
begin
set @word=left(@str,1)
--如果非汉字,笔划当0计
set @n=@n+(case when unicode(@word) between 19968 and 19968+20901
then (select top 1 id from (
select 1 as id,N'亅' as word
union all select 2,N'阝'
union all select 3,N'马'
union all select 4,N'风'
union all select 5,N'龙'
union all select 6,N'齐'
union all select 7,N'龟'
union all select 8,N'齿'
union all select 9,N'鸩'
union all select 10,N'龀'
union all select 11,N'龛'
union all select 12,N'龂'
union all select 13,N'龆'
union all select 14,N'龈'
union all select 15,N'龊'
union all select 16,N'龍'
union all select 17,N'龠'
union all select 18,N'龎'
union all select 19,N'龐'
union all select 20,N'龑'
union all select 21,N'龡'
union all select 22,N'龢'
union all select 23,N'龝'
union all select 24,N'齹'
union all select 25,N'龣'
union all select 26,N'龥'
union all select 27,N'齈'
union all select 28,N'龞'
union all select 29,N'麷'
union all select 30,N'鸞'
union all select 31,N'麣'
union all select 32,N'龖'
union all select 33,N'龗'
union all select 35,N'齾'
union all select 36,N'齉'
union all select 39,N'靐'
union all select 64,N'龘'
) T
where word>=@word collate Chinese_PRC_Stroke_CS_AS_KS_WS
order by id ASC) else 0 end)
set @str=right(@str,len(@str)-1)
end
return @n
end
--函数调用实例:
select dbo.fun_getbh('中华人民共和国'),dbo.fun_getbh('中華人民共和國')
returns int
as
begin
declare @word nchar(1),@n int
set @n=0
while len(@str)>0
begin
set @word=left(@str,1)
--如果非汉字,笔划当0计
set @n=@n+(case when unicode(@word) between 19968 and 19968+20901
then (select top 1 id from (
select 1 as id,N'亅' as word
union all select 2,N'阝'
union all select 3,N'马'
union all select 4,N'风'
union all select 5,N'龙'
union all select 6,N'齐'
union all select 7,N'龟'
union all select 8,N'齿'
union all select 9,N'鸩'
union all select 10,N'龀'
union all select 11,N'龛'
union all select 12,N'龂'
union all select 13,N'龆'
union all select 14,N'龈'
union all select 15,N'龊'
union all select 16,N'龍'
union all select 17,N'龠'
union all select 18,N'龎'
union all select 19,N'龐'
union all select 20,N'龑'
union all select 21,N'龡'
union all select 22,N'龢'
union all select 23,N'龝'
union all select 24,N'齹'
union all select 25,N'龣'
union all select 26,N'龥'
union all select 27,N'齈'
union all select 28,N'龞'
union all select 29,N'麷'
union all select 30,N'鸞'
union all select 31,N'麣'
union all select 32,N'龖'
union all select 33,N'龗'
union all select 35,N'齾'
union all select 36,N'齉'
union all select 39,N'靐'
union all select 64,N'龘'
) T
where word>=@word collate Chinese_PRC_Stroke_CS_AS_KS_WS
order by id ASC) else 0 end)
set @str=right(@str,len(@str)-1)
end
return @n
end
--函数调用实例:
select dbo.fun_getbh('中华人民共和国'),dbo.fun_getbh('中華人民共和國')
- 判断汉字的笔画数
- 获取GBK编码的汉字笔画数
- 用java实现汉字的笔画数
- 取得汉字笔画数
- 汉字和笔画数
- 汉字的奥秘: 获取汉字的笔画数
- VBS 计算汉字笔画数
- SQL 获取汉字笔画数
- [轮子]获取汉字笔画数
- java获取汉字笔画数
- 用java实现汉字的笔画数(转贴)
- 用java实现汉字的笔画数(转贴)
- SQLSERVER中实现返回汉字笔画数的函数
- 检查输入汉字的笔画数(简体中文)
- 汉字笔画的计算。
- C#中如何获取汉字的笔画数和汉字的拼音
- 取得汉字笔画数(WORD 版) (VBA)
- C# 计算中文汉字笔画数
- 用JAVA实现一个分页类
- 调用带参数存储过程
- 让E-Mail拥有数字签名
- JAVA代码编写的30条建议
- 感谢csdn的工作人员
- 判断汉字的笔画数
- JAVA内存管理
- 两个小函数让你的ASP程序对SQL注入免疫
- 使用Event同步线程
- SharePoint 2003 安装续
- 水晶报表应用之登录失败及导出解决方案
- Windows消息机制初谈
- Hibernate技术
- 民用 军用 汽车牌照一览