Einzelnen Beitrag anzeigen

Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.027 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#7

Re: wie kann ich ' aus einem string entfernen?

  Alt 14. Okt 2004, 08:52
Das hier ist auf jeden Fall schneller:
Delphi-Quellcode:
  try
    List.LoadFromFile(FFileName);
    Dumplist := List.Text;
    iCount := 1;
    iLength := Length(Dumplist);
    Dumplist2 := '';
    while iCount <= iLength do
    begin
      case Dumplist[iCount] of
      '[':
         if (iCount < iLength) and (Dumplist[iCount+1] = '[') then
           Inc(iCount)
         else
           Dumplist2 := Dumplist2 + DumpList[iCount];
      ']':
         if (iCount < iLength) and (Dumplist[iCount+1] = ']') then
           Inc(iCount)
         else
           Dumplist2 := Dumplist2 + DumpList[iCount];
      '\':
         if (iCount < iLength) then
           case DumpList[iCount+1] of
           'n': Inc(iCount);
           '''': Inc(iCount);
           else
             Dumplist2 := Dumplist2 + DumpList[iCount];
         end;
      else
        Dumplist2 := Dumplist2 + DumpList[iCount];
      end;
      Inc(iCount);
    end;
    List.Text := Dumplist2;
    List.SaveToFile(FFileName2);
  finally
    FreeAndNil(List);
  end;
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight
  Mit Zitat antworten Zitat