[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

IntToHex

Convert an integer value to a hexadecimal string.

Declaration

Source position: line 0

function IntToHex(

  Value: Integer;

  Digits: Integer

):String;

function IntToHex(

  Value: Int64;

  Digits: Integer

):String;

Description

IntToHexconverts Valueto a hexadecimal string representation. The result will contain at least Digitscharacters. If Digitsis less than the needed number of characters, the string will NOT be truncated. If Digitsis larger than the needed number of characters, the result is padded with zeroes.

Errors

None.

See also

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.