Function

ArrayToHexStr

Module

XlfHex

Last Modified

7/15/2014 3:26:44 PM

Comments

The first argument is a byte array with the data
to convert.
pbData: Array[0..20] of byte
 hex := ArrayToHexStr(pbData, length)

Scope

Interfaced

Declaration

function ArrayToHexStr(pba: Pchar; len: integer): string;


Source

13    function ArrayToHexStr;
14    //The first argument is a byte array with the data
15    //to convert.
16    //pbData: Array[0..20] of byte
17    // hex := ArrayToHexStr(pbData, length)
18    var
19       i,v: integer;
20       s: string;
21    begin
22         //Convert the Array to a Hex string
23         Result := '';
24         s := '';
25         for i := 0 to len-1 do
26             begin
27              v := integer(pba[i]);
28              s := s + intToHex(v,2);
29              end;
30         Result := lowercase(s);
31    end;