Convertir Integer -> Hexadecimal  

Enviado Por: Q3 Team
Web : www.q3.nu
Email: dlib@q3.nu
Fecha: 02/08/99

Truco accedido 93 veces

 


  • Integer -> Hexadecimal


     	HexVal := IntToHex(IntVal,8);
    


    Con una función:


     	function IntToHex2( n:integer ):string;
     	 const hex:array [0..15] of char
     	    =('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
     	begin
     	 while n<>0 do begin
     	    result:=hex[ 15 and n ]+result; {=(n mod 15)}
     	    n:=n shr 4; end; {=n div 16}
     	end;
    



    Ejemplo de llamada:


                    HexString:=IntToHex2 ('666')
    




  • LongInt ->Hexadecimal String


     	hexString:=Format('%x',[LongIntNumber]);