Einzelnen Beitrag anzeigen

Benutzerbild von Dalai
Dalai

Registriert seit: 9. Apr 2006
1.680 Beiträge
 
Delphi 5 Professional
 
#9

AW: replace string with spaces?

  Alt 19. Jan 2020, 16:51
But not in Delphi 6.
Yes, it does. I just tested it in Delphi 5:
Delphi-Quellcode:
program Project1;
{$APPTYPE CONSOLE}
uses
  sysutils,
  classes;

var
   tmpstr: TStringList;
   s: string;

begin
  tmpstr:= TStringList.Create;
  try
    tmpstr.LoadFromFile('c:\boot.ini');
    s:= StringReplace(tmpstr.Text, 'boot loader', 'boot blubber', [rfReplaceAll]);
    WriteLn(s);
  finally
    tmpstr.Free;
  end;
  ReadLn;
end.
works just fine in Windows 2000 and replaces 'boot loader' with 'boot blubber'. If you really use the code from post #5 above, it's no wonder it doesn't work because you don't assign the result of the StringReplace function to anything.

Regards
Dalai
  Mit Zitat antworten Zitat