请问在DELPHI中怎样将ASCII码转化为BCD码,在线等待

解决方案 »

  1.   

    const 
      BCD: array [0..15] of string = 
        ('0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111', 
        '1000', '1001', '1010', '1011', '1100', '1101', '1110', '1111'); 
    var 
      i: integer; 
    begin 
      for i := Length(Hexadecimal) downto 1 do 
        Result := BCD[StrToInt('$' + Hexadecimal[i])] + Result; 
    end;
      

  2.   

    对不起,我是指将 1000 --> #$03#$E8
      

  3.   

    var i:integer;
        p:pByte;
        a:array[0..3] of byte;
    begin
      i:=1000;
      p:=@i;
      a[1]:=p^;
      inc(p,1);
      a[0]:=p^;
      showmessage(inttoHex(a[0],1));
      showmessage(inttoHex(a[1],1));
    end;
      

  4.   

    function StrToBcd( const aValue: string): TBcd;
      

  5.   

    jinjazz(人雅的标记--落寞刺客) 的方法非常巧妙!  学习 哈哈!