function TAuswerten.PlainText(strHTML: string): string;
var
P: PChar;
InTag: Boolean;
begin
// <head> löschen
while (Pos('<head',strHTML) > 0) and
(Pos('</head>',strHTML) > Pos('<head',strHTML)) do
Delete(strHTML, Pos('<head',strHTML), (Pos('</head>',strHTML) + 7) - Pos('<head',strHTML));
// <script> löschen
while (Pos('<script',strHTML) > 0) and
(Pos('</script>',strHTML) > Pos('<script',strHTML)) do
Delete(strHTML, Pos('<script',strHTML), (Pos('</script>',strHTML) + 9) - Pos('<script',strHTML));
// <style> löschen
while (Pos('<style',strHTML) > 0) and
(Pos('</style>',strHTML) > Pos('<style',strHTML)) do
Delete(strHTML, Pos('<style',strHTML), (Pos('</style>',strHTML) + 8) - Pos('<style',strHTML));
// Alle tags werden durch leerzeichen ersetzt
strHTML := StringReplace(strHTML,'>','> ',[rfReplaceAll]);
P := PChar(strHTML);
Result := '';
InTag := False;
repeat
case P^ of
'<': InTag := True;
'>': InTag := False;
#13, #10: ; // nichts machen
else
if not InTag then
begin
if (P^ in [#9, #32]) and ((P+1)^ in [#10, #13, #32, #9, '<']) then
else
Result := Result + P^;
end;
end;
Inc(P);
until (P^ = #0);
Result := StringReplace(Result, 'ä', 'ä', [rfReplaceAll]);
Result := StringReplace(Result, 'ö', 'ö', [rfReplaceAll]);
Result := StringReplace(Result, 'ü', 'ü', [rfReplaceAll]);
Result := StringReplace(Result, 'ß', 'ß', [rfReplaceAll]);
Result := StringReplace(Result, '', ' ', [rfReplaceAll]);
Result := StringReplace(Result, '*', ' ', [rfReplaceAll]);
Result := StringReplace(Result, '>', '>', [rfReplaceAll]);
Result := StringReplace(Result, '<', '<', [rfReplaceAll]);
{ Result := StringReplace(Result, '"', '"', [rfReplaceAll]);
Result := StringReplace(Result, ''', '''', [rfReplaceAll]);
Result := StringReplace(Result, '&', '&', [rfReplaceAll]);}
end;