DelphiBasics
IntToHex
Function
Convert an Integer into a hexadecimal string SysUtils unit
 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
 Download this web site as a Windows program.

Development Boards at very low prices with free postage.


 
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
 
 
Delphi Programming Neil Moffatt 2002 - 2014. All rights reserved.  |  Contact the author  |  Home Page