Hier eine Version, die nochmal 50% rausholt (die Zeit also quasi halbiert)
Delphi-Quellcode:
function PRemoveChars(const aString: string; Chars: TChars): string;
var
pSource, pResult, pEnd: PChar;
begin
SetLength(Result, Length(aString));
pSource := @aString[1];
pResult := @Result[1];
pEnd := pSource + Length(aString) - 1;
while pSource <= pEnd do begin
if not (pSource^ in Chars) then begin
pResult^ := pSource^;
inc(pResult);
end;
inc(pSource);
end;
SetLength(Result, integer(pResult) - integer(@Result[1]));
end;