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


    //判断字符是否是汉字 
    
     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;

      

  • 相关阅读:
    js_未结束的字符串常量
    [转]关于项目管理的思考
    Nhibernate理解
    Visual Studio 2005常用插件搜罗
    基本概念
    resharper 2.0
    Nhibernate资源
    [转]关于项目管理的知识点
    style
    带分数 蓝桥杯
  • 原文地址:https://www.cnblogs.com/qingsong/p/4033109.html
Copyright © 2020-2023  润新知