Board index » delphi » Ascii to HEX to ascii

Ascii to HEX to ascii

How can i translate Ascii code to there reprensative HEX value
ie, if i receive the current string,

a,b,c,d,e (ascii)

how can i convert them to:

41,42,43,44,45 (HEX)

And then, reconvert those new value to
a,b,c,d,e

Thanks..

Mike

 

Re:Ascii to HEX to ascii


Use:

function AscToHex(C: Char): String;
begin
  Result := IntToHex(Byte(C), 2);
end;

function HexToAsc(H: String): Char;
begin
  Result := Char(StrToInt('$' + H));
end;

"Michel Hudon" <hud...@globetrotter.qc.ca> schreef in bericht
news:rSs%4.19718$NS6.263225@news.globetrotter.net...

Quote
> How can i translate Ascii code to there reprensative HEX value
> ie, if i receive the current string,

> a,b,c,d,e (ascii)

> how can i convert them to:

> 41,42,43,44,45 (HEX)

> And then, reconvert those new value to
> a,b,c,d,e

> Thanks..

> Mike

Other Threads