Home     Projects     Micro     Tools     Delphi     Developer     Site map
HOME  
 
Delphi index
 
Convert Byte to HEX string
function ByteToHex(InByte:byte):shortstring;
const Digits:array[0..15] of char='0123456789ABCDEF';
begin
 result:=digits[InByte shr 4]+digits[InByte and $0F];
end;
					  


Description

This is a function that converts a Byte into a string containing the number's hexadecimal (base 16) representation.InByte is the number which we want to convert.


Example :

MyHex := ByteTohex($FF);
the result
MyHex is "FF".

MyHex := ByteTohex(255);
the result
MyHex is "FF".

MyHex := ByteTohex($55);
the result
MyHex is "55".



 
Copyright(c) 2005-2008 sixca.com, All right reserved.
Best view @ 800X600, IE 6.0 up   
Terms of Use  Privacy Policy