I've since rewritten the routine using a different algorithm which works fine, but I'd still like to know what's wrong with this. I've been working on it for a couple of days now with no luck.
function esc (str : string) : string ;
{
ESCAPEs for NUL, TAB, CR, LF, BLANK , etc
}
var
i : byte ;
begin
for i := 1 to length(str) - 1 do begin
if str[i] = ESCAPE then begin
delete (str, i, 1) ;
case locase(str[i]) of
ZERO : str[i] := NUL ;
LETA : str[i] := AMP ;
LETB : str[i] := BLANK ;
LETC : str[i] := CARET ;
LETF : str[i] := FEED ;
LETG : str[i] := GREATER ;
LETL : str[i] := LESS ;
LETP : str[i] := BAR ; { p for pipe }
LETR : str[i] := RETURN ;
LETT : str[i] := TAB
end { case }
end
end ;
esc := str
end ;


Sign In
Create Account


Back to top










