HOME  
 
 Home     Projects     Micro     Tools     Delphi     Developer     Site map
Delphi index
 
How to convert integer to HEX string

There is a function for convert an integer to Hex in delphi .

function IntToHex(Value: Integer; Digits: Integer): string;


Description

IntToHex converts a number into a string containing the number's hexadecimal (base 16) representation. Value is the number to convert. Digits indicates the minimum number of hexadecimal digits to return.It the Digits is less than the actual length of hexadecimal it return full length of that hexadecimal.




Example :

MyHex := inttohex(255,2);
the result
MyHex is FF.

MyHex := inttohex(255,6);
the result
MyHex is 0000FF.

MyHex := inttohex(12345,1);
the result
MyHex is 3039.




 
Copyright(c) 2005-2010 sixca.com, All rights reserved.
Best view @ 800X600, IE 6.0 up Terms Privacy