function HexByte(Hexchar: char): Integer;
begin
case Hexchar of
'0'..'9': Result:= Ord(Hexchar) - Ord('0');
'A'..'F': Result:= Ord(Hexchar) - Ord('A');
'a'..'f': Result:= Ord(Hexchar) - Ord('a');
else
Result:= 0;
end;
end;
function HexToStrZ(const HexStr: String): String;
var
M, N, X, St: Integer;
buf: array [0..255] of Byte;
begin
St:= 0;
M:= 0;
for N:= 1 to Length(HexStr)do
begin
if HexStr[N] in [' ',','] then
begin
if St = 0 then
begin
buf[M]:= X;
Inc(M);
end;
St:= 1;
end else
begin
case St of
1: begin
X:= HexByte(HexStr[N]);
St:= 2;
end;
2: begin
X:= (X * 16) + HexByte(HexStr[N]);
St:= 0;
end;
end;
end;
end;
SetString(Result, @buf[0], M);
end;