Filtri Menu 0 0.00

Delphi – Int to Hex and Hex to Int

Delphi – Int to Hex and Hex to Int

int2hex example in delphi:


var
str : string; // hex value
b : byte;
begin
b := 15;
str := system.sysutils.inttohex(b,2);
end;

// the result in str will be : ‘0F’

hex2int example:


var
strHexVal : string; // hex value
intVal : integer;
begin
strHexVal := ‘0F’;
intVal := StrToInt(‘$’ + strHexVal);
end;

// the result in intVal will be : 15

Share:

Subscribe to newsletter

Subscribe to our newsletter to receive early discount offers, updates and new products info.
Top