IntToHex

Convert an integer value to a hexadecimal string.

Declaration

Source position: sysstrh.inc line 120

  function IntToHex(Value: LongInt; Digits: Integer) : string;
  function IntToHex(Value: Int64; Digits: Integer) : string;
  function IntToHex(Value: QWord; Digits: Integer) : string;
  function IntToHex(Value: Int8) : string;
  function IntToHex(Value: UInt8) : string;
  function IntToHex(Value: Int16) : string;
  function IntToHex(Value: UInt16) : string;
  function IntToHex(Value: Int32) : string;
  function IntToHex(Value: UInt32) : string;
  function IntToHex(Value: Int64) : string;
  function IntToHex(Value: UInt64) : string;

Description

IntToHex converts Value to a hexadecimal string representation. The result will contain at least Digits characters. If Digits is less than the needed number of characters, the string will NOT be truncated. If Digits is larger than the needed number of characters, the result is padded with zeroes.

Errors

None.

See also

Name Description
IntToStr Convert an integer value to a decimal string.

Example

Program Example73;
{ This program demonstrates the IntToHex function }
Uses sysutils;
Var I : longint;
Begin
  For I:=0 to 31 do
      begin
      Writeln (IntToHex(1 shl I,8));
      Writeln (IntToHex(15 shl I,8))
      end;
End.