Performancetuning, au fein...
Hatten wir mal
hier
Hier die Version von Hawkeye219, die alles in den Schatten stellt.
Delphi-Quellcode:
function RemoveDoubleBlanks(const s: string): string;
var
pRead, pEnd, pWrite : PChar;
begin
pRead := PChar(s);
pEnd := pRead + Length(s);
SetLength (Result, Length(s));
pWrite := PChar(Result);
while (pRead <> pEnd) do
begin
repeat
pWrite^ := pRead^;
Inc (pRead);
Inc (pWrite);
until ((pRead[-1] = ' ') or (pRead = pEnd));
while (pRead^ = ' ') do
Inc (pRead);
end;
SetLength (Result, pWrite - PChar(Result));
end;