将每字节内码转换成两个十六进字符串就可以:
5e7be4a346
但字节数多了一倍
5e7be4a346
但字节数多了一倍
解决方案 »
- 关于Delphi的帮助
- 关联查询出现缺少更新的或刷新的键列信息
- 由delphi2007升级到delphi2009,发现操作sqlserver出现了奇怪问题?????
- fastreport 奇怪问题
- 为什么我的query控键的datasource属性没有选的啊?
- DLL动态调用!
- 请教mscomm的使用方法、属性资料
- Pascal中有没有中断循环和中段一次循环的语句?
- 有关BITBTN的问题!UP有分!
- xp控件如何安装?
- 我用Table连接Access 数据库,程序运行时出现 Database Login窗口,它是干什么的?
- 有哪位老兄用过爱华POS机,顾客显示器和钱箱是如何驱动的,请告知,在下先多谢了!!!
var c:char;
i:integer;
begin
c:=#255;
i:=integer(c);
ShowMessage(IntToHex(i,2));
end;
你写个函数吧,如把'?b?B?尋@\)'转成一串十六进字符串
再写个函数把该字符串转回来。
我把分加到300分:)
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.
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.