一些特殊文字的过滤---Private Use Area:E000-F8FF

本文地址:http://www.cnblogs.com/vnii/archive/2012/12/26/2834076.html

参考字符地址:

http://jrgraphix.net/r/Unicode/E000-F8FF

http://www.iam.uni-bonn.de/~alt/html/unicode_203.html

 

-- =============================================
-- Author:        忧郁的匹格
-- Create date: 2012.12.26
-- Description:    将字符串中无法识别的字符给移除
-- =============================================
Create FUNCTION [dbo].[fun_formatPUAchar]
(    
    @V varchar(max)
)
RETURNS varchar(max) as  
    BEGIN 

        declare @i int=1
        declare @c int=0
        declare @u int=0

        select @c=len(@v)

        while @i<=@c
        Begin
            Set @u=0
            Set @u=UNICODE(SUBSTRING(@v,@i,1))
            if @u<=63743 and @u>=57344
            Begin
                Set @v=SUBSTRING(@v,1,@i-1)+SUBSTRING(@v,@i+1,@c)
                Set @c=@c-1
            End
            Else
            Begin
                Set @i=@i+1
            End
        End
        return @v
    END
Go

使用方法 : SELECT dbo.fun_formatPUAchar('忧郁的匹格,,忧郁的匹格')

 

 

 

posted on 2012-12-26 14:54  忧郁的匹格  阅读(1168)  评论(0编辑  收藏  举报