Und der hier dürfte letztlich am schnellsten sein:
Delphi-Quellcode:
function ReduceMultiples(const s: string; c: char): string;
var i, pos: Integer;
begin
SetLength(result, Length(s));
pos := 1;
for i := 1 to Length(s) do
begin
if (i = 1) or (result[pos-1] <> s[i]) then
begin
result[pos] := s[i];
Inc(pos);
end;
end;
SetLength(result, pos-1);
end;