{**} function HexToStr(const s:string; const Len: integer):string;
{**} function ParseRecord(const s: string; var Id: word; var Version:Word; var Size: int64; var HexData: string; var Posi: integer; const IsBiff: boolean): boolean;
for i:=1 to Length(s) do if s[i] in [#0..#31,'"',''''] then result:=result+'.' else result:=result+s[i];
end;
function TrimWoZero(const s:string):string;
var
R: string;
begin
R:=Trim(s);
while (length(R)>0) and (R[1]='0') do delete(R,1,1);
Result:=R;
end;
function StrToHex(const s:string):string;
var
i,z:integer;
P:PChar;
begin
if Length(s)=0 then begin; Result:='';exit;end;
SetLength(Result, 3*Length(s)+1); //the extra byte is for #0;
P:=PChar(@(Result[1]));
z:=0;
for i:=1 to Length(s) do
begin
StrFmt(P+Z, '%2.2x ',[ord(s[i])]);
inc(z,3);
end;
SetLength(Result, 3*Length(s));
end;
function HexToStr(const s:string; const Len: integer):string;
var
i,k:integer;
begin
SetLength(Result, Len);
k:=1;
for i:=1 to Len do
begin
if k+1>length(s) then Raise Exception.Create(ErrBadString);
Result[i]:=chr(StrToInt('$'+ s[k]+ s[k+1]));
if (k+2<=length(s)) and (s[k+2]<>' ') then Raise Exception.Create(ErrBadString);
inc(k,3);
end;
if length(s)>=k then Raise Exception.Create(ErrBadString);
end;
function ParseRecord(const s: string; var Id: word; var Version:Word; var Size: int64; var HexData: string; var Posi: integer; const IsBiff: boolean): boolean;
var
Posi2: integer;
begin
if Posi>Length(s) then begin Result:=false;exit;end;