Board index » delphi » Convert string to hex

Convert string to hex

How do I convert a string to hex, and more specifically a character to hex?

 

Re:Convert string to hex


Quote
p...@adnc.com (Phil Moskal) wrote:
>How do I convert a string to hex, and more specifically a character to hex?

var
  ch : char;
  hexStr : string;

begin
  hexStr := IntToHex(Ord(ch), 2);
  label1.Caption := hexStr;
end;

Jay Cole
==========
NitroSort, Mainframe file sort performance at PC prices, see
www.nitrosort.com.

Re:Convert string to hex


Quote
>   p...@adnc.com (Phil Moskal) writes:
>  How do I convert a string to hex, and more specifically a character to hex?

There is an inttohex function.
So if you have a character maybe you could use inttohex(ord(character))

johan

Re:Convert string to hex


Phil Moskal <p...@adnc.com> wrote in article
<5h969h$...@taurus.adnc.com>...

Quote
> How do I convert a string to hex, and more specifically a character to
hex?

Strings to hex is easy...

  myString:=IntToHex(StrToIntDef(myString,0),8);

Other Threads