区分汉字和字母的函数delphi

function gthz(s:string):string;
var i:integer;
begin
  result:='';
  for i:= 0 to Length(s) do
   begin
     if (Ord(s[i]) >= 127) then
     result:=result+s[i];
   end;
end;

区分汉字和字母的函数 sqlserver

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[gethz]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[gethz]
go

Create function gethz( @string nvarchar(4000) )
returns nvarchar(4000)
as
begin

declare @returnstr nvarchar(4000)
set @returnstr=''

DECLARE @position int, @nstring nchar(9)
SET @position = 1
WHILE @position <= DATALENGTH(@string)
   BEGIN
    if UNICODE(SUBSTRING(@string, @position, 1))>127
    set @returnstr= isnull(@returnstr,'')+ SUBSTRING(@string, @position, 1)

   set @position = @position + 1
   END

  return @returnstr

end



相关文章:

  • 2021-12-14
  • 2022-01-11
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2021-11-16
猜你喜欢
  • 2021-11-17
  • 2022-02-07
  • 2021-11-02
  • 2021-06-24
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案