入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

Delphi判断一个字符是否为汉字的最佳方法

创建时间:2011-07-27 投稿人: 浏览次数:4578
 

 
//判断字符是否是汉字  function IsHZ(ch: WideChar): boolean;  var    i:integer;  begin    i:=ord(ch);    if( i<19968) or (i>40869) then      result:=false else result:=true;  end;  
//判断字符是否是汉字function IsHZ(ch: WideChar): boolean;var  i:integer;begin  i:=ord(ch);  if( i<19968) or (i>40869) then    result:=false else result:=true;end;
//判断字符是否是汉字  function TForm1.IsHZ(ch: Char): boolean;  begin    //返回值为 0 的时候为单字节字符,返回值为 1 的时候为多字节字符    if(ord(bytetype(ch,1))=1) then result:=true    else result:=false;  end;  
//判断字符是否是汉字function TForm1.IsHZ(ch: Char): boolean;begin  //返回值为 0 的时候为单字节字符,返回值为 1 的时候为多字节字符  if(ord(bytetype(ch,1))=1) then result:=true  else result:=false;end;
//判断字符是否是汉字  function IsMBCSChar(const ch: Char): Boolean;   begin     Result := (ByteType(ch, 1) <> mbSingleByte);   end;   
 



声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
  • 上一篇:没有了
  • 下一篇:没有了
未上传头像