Miguel A Pérez E wrote:
I have an integer variable and I am looking for the easiest way to convert it to an ascii or hexa form.
sNumber := HexaToAscii( '30414439');
Then sNumber results in '0AD9'
But the string '30414439' is in hexa and it corresponds with the decimal number 809583673.
What function will allow me to obtain that hexa string or the ascii string from the integer number?
I do not know of any builtin, but you can easily write one like:
function HexaString(i:cardinal) = s : string; const HexChars: array[0..15] of char = '0123456789ABCDEF'; begin s:=''; while i>0 do begin s:=HexChars[i and $F]+s; i:=i shr 4; end; end;
Maurice