08/05/11 08:09:33
function DecodeEscStr(const s: string): string;
var i: integer;
begin
Result := ''; i := 1;
while i <= length(s) do
if s[i] in LeadBytes then
begin Result := Result + copy(s, i, 2); inc(i, 2);
end else begin
if s[i] = '\' then
begin inc(i); case s[i] of
'x':try
Result := Result + char(StrToInt('$' + s[i + 1] + s[i + 2]));
inc(i, 2);
except end;
'b': Result := Result + #$08;
'a': Result := Result + #$07;
'f': Result := Result + #$0C;
'r': Result := Result + #$0D;
't': Result := Result + #$09;
'v': Result := Result + #$0B;
'n': Result := Result + #13 + #10;
else Result := Result + s[i];
end;
inc(i);
end else begin
Result := Result + s[i]; inc(i);
end;
end;
end;