将每字节内码转换成两个十六进字符串就可以:
5e7be4a346
但字节数多了一倍

解决方案 »

  1.   

    function IntToHex(Value: Integer; Digits: Integer): string; 
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var c:char;
        i:integer;
    begin
          c:=#255;
          i:=integer(c);
          ShowMessage(IntToHex(i,2));
    end;
      

  3.   

    BCB(:))
    你写个函数吧,如把'?b?B?尋@\)'转成一串十六进字符串
    再写个函数把该字符串转回来。
    我把分加到300分:)
      

  4.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    function s2h(s:string):string;   { 串->16进串 }
    var i:integer;
        c:integer;
        h:string;
    begin
        h:='';
        for i:=1 to  Length(s) do
           begin
             c:=ord(s[i]);
             h:=h+IntToHex(c,2);
           end;
        s2h:=h;
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    var s:string;
    begin
        s:=' 中 华 人 民 共 和 国';
        ShowMessage(s2h(s));end;end.
      

  5.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    function s2h(s:string):string;   { 串->16进串 }
    var i:integer;
        c:integer;
        h:string;
    begin
        h:='';
        for i:=1 to  Length(s) do
           begin
             c:=ord(s[i]);
             h:=h+IntToHex(c,2);
           end;
        s2h:=h;
    end;function h2s(s:string):string;   { 16进串-->串 }
    var i:integer;
        h:string;
        r:String;
    begin
        r:='';
        for i:=1 to  Length(s) div 2 do
           begin
             h:='0x'+String(s[i*2-1])+String(s[i*2]);
             r:=r+String(chr(StrToInt(h)));
           end;
        h2s:=r;
    end;procedure TForm1.Button1Click(Sender: TObject);
    var s:string;r:string;
    begin
        s:=' 中 华 人 民 共 和 国';
        r:=s2h(s);
        ShowMessage(r);
        ShowMessage(h2s(r));   { 又转换回来 }
    end;end.