ji

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var s:string;
        i,m:integer;
    begin
      s:='中国de山大324市';  //字符
      m:=10;                 //第几个位置
      if ord(s[m])<128 then showmessage('<128')
      else
      begin
        for i:=m downto 0 do
        if (i>0)and(ord(s[i])<128) then break;
        if (m-i) mod 2=1 then showmessage('上') else showmessage('下')
      end;
    end;
      

  2.   

    晕 我理解错了还以为 随便一个位置判断是某个汉字<字母> 的前半部分 还是 后半部分。。
      

  3.   

    用這個也可:function ByteType(const S: string; Index: Integer): TMbcsByteType;
    if ByteType(aWord, Length(aWord)) = mbTrailByte then
      

  4.   

    ~~~郁闷,费了半天劲Indicates whether a byte in a string is a single byte character, the first byte of a double byte character, or the second byte of a double byte character.
      

  5.   

    随便一个位置判断是某个汉字<字母> 的前半部分 还是 后半部分。。
    我问的就是这个呀!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      

  6.   

    Indicates whether a byte in a string is a single byte character, the first byte of a double byte character, or the second byte of a double byte character.UnitSysUtilsCategoryMBCS utilitiesDelphi syntax:function ByteType(const S: string; Index: Integer): TMbcsByteType;C++ syntax:extern PACKAGE TMbcsByteType __fastcall ByteType(const AnsiString S, int Index);DescriptionCall ByteType to determine whether a specified byte in a string is a single-byte character, the first byte of a multibyte character, or one of the trailing bytes.AnsiString is the string that contains the byte in question.Index identifies the byte for which you want to know the byte type. Bytes are numbered from 1.If the system is not using a multi-byte character system (MBCS), ByteType always returns mbSingleByte. Otherwise, ByteType returns mbSingleByte if the indicated byte represents a complete character in S, mbLeadByte if it represents the first byte of a double byte character, and mbTrailByte if it represents a subsequent byte of a multibyte character.Note: No checking is done to ensure that Index is less than the length of S. It is the caller's responsibility to ensure that Index is not out of bounds.=========================================================================================TMbcsByteType represents the use of a single byte in a string that uses a multi-byte character set (MBCS).UnitSysUtilsDelphi syntax:type TMbcsByteType = (mbSingleByte, mbLeadByte, mbTrailByte);C++ syntax:enum TMbcsByteType { mbSingleByte, mbLeadByte, mbTrailByte };DescriptionTMbcsByteType represents the possible return values of the ByteType and StrByteType functions.  Possible values are as follows:Values MeaningmbSingleByte The char is used to represent an entire character in the string. The value of Char can not be included in the LeadBytes set.
    mbLeadByte The char is used to represent the first byte of a multi-byte character.  The value of Char must be included in the LeadBytes set.
    mbTrailByte The char is used to represent one of the trailing bytes in a multi-byte character. There are no a priori restrictions on the value of char.