<!--
HTMLから読み取り可能なテキストを文字列に抽出しているので、と-->
タグの間の既存のテキストを削除する必要があります。これを達成するための最も効率的な方法は何でしょうか?
今、私はそれをこのようにやっています:
function RemoveIEScripts(const s: string): string;
var
i: Integer;
InTag: Boolean;
begin
Result := '';
InTag := False;
for i := 1 to Length(s)-3 do
begin
if (s[i] = '<') and (s[i+1] = '!') and (s[i+2] = '-') then
inTag := True
else if (s[i] = '-') and (s[i+1] = '-') and (s[i+2] = '>') then
inTag := False
else if not InTag then
Result := Result + s[i];
end;
end;
これを行うためのより良い方法はありますか?