Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Delphi – Int to Hex and Hex to Int

Digital solution partner

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