Nur mal die erste Funktion:
Delphi-Quellcode:
function CutTags(const s: string): string; // ehemals st()
var
lSource, lDest: PChar;
lStart: Pointer;
lResult: string;
lOpenTag: boolean;
begin
lSource := PChar(s);
SetLength(lResult, length(s));
lDest := PChar(lResult);
lStart := lDest;
if assigned(lSource) then // leerer String
begin
lOpenTag := false;
// while lChar^ <> #0 do nur AnsiString
while ord(lSource^) <> 0 do
begin
if ( lSource^ = '<' ) and not lOpenTag then
lOpenTag := true
else if ( lSource^ = '>' ) and lOpenTag then
begin
lOpenTag := false
lDest^ := ' ';
Inc(lDest);
end
else if not lOpenTag then
begin
lDest := lSource
Inc(lDest);
end;
Inc(lSource);
end;
end;
SetString(result, lStart, lDest - lStart);
end;