Das while Pos(....)
kannst du weglassen, weil du ja schon ein rfReplaceAll drin hast....
Nope, da liegst Du falsch.
Teste mal folgenden Code:
Delphi-Quellcode:
procedure TestWhile;
var
SomeText: string;
const
SOURCE = 'ab\\\cd';
begin
SomeText := SOURCE;
while Pos('\\', SomeText) > 0 do
SomeText := StringReplace(SomeText, '\\', '\', [rfReplaceAll]);
Writeln('WHILE: ', SomeText);
SomeText := SOURCE;
SomeText := StringReplace(SomeText, '\\', '\', [rfReplaceAll]);
Writeln('DIRECT: ', SomeText);
end;
...
...