Functions Delphi

function IntToHex ( DecimalValue : Integer; MinimumWidth : Integer ) : string;


Description
The IntToHex function converts a DecimalValue integer into a hexadecimal format sting of at least MinimumWidth characters wide.

The resulting string has no prefix character.

Related commands
IntToStr Convert an integer into a string
StrToInt Convert an integer string into an Integer value

Example code : Convert an integer to a hex format
begin
// Display 123 decimal in hex with minimal width
ShowMessage('1234 decimal = '+IntToHex(1234, 1));
// Display 123 decimal in hex with fixed width
ShowMessage('1234 decimal = '+IntToHex(1234, 8));
end;

Show full unit code
1234 decimal = 4D2
1234 decimal = 000004D2