【D2010】里如何将汉字数字字母混合的字符串【互转】16进制?(50)

  • 主题发起人 yeszhang
  • 开始时间
Y

yeszhang

Unregistered / Unconfirmed
GUEST, unregistred user!
如题,原来D7写的函数转为16进制再转回来就是乱码...求这两个函数汉字数字字母混合字符串转成16进制16进制转回字符串...多谢
 
//string to hexprocedure TForm1.Button1Click(Sender: TObject);var phex, pbin: Pchar; s: string;begin s := Edit1.Text; pbin := pchar(s); try GetMem(phex, 1000); FillMemory(phex, 1000, 0); BinToHex(pbin, phex, length(pbin)); Edit1.Text := StrPas(phex); finally FreeMem(phex); end;end;//Hex to strprocedure TForm1.Button2Click(Sender: TObject);var phex, pbin: Pchar; s: string;begin phex := pchar(Edit1.Text); try GetMem(pbin,1000); FillMemory(pbin,1000,0); HexToBin(phex,pbin,length(phex)); Edit1.Text := StrPas(pbin); finally FreeMem(pbin); end;end;
 

Similar threads

回复
0
查看
666
不得闲
S
回复
0
查看
950
SUNSTONE的Delphi笔记
S
S
回复
0
查看
772
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部