Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Pfade vegleichen... (https://www.delphipraxis.net/89057-pfade-vegleichen.html)

Hawkeye219 25. Mär 2007 14:03

Re: Pfade vegleichen...
 
Hallo,

hier ist noch eine Routine (ohne Gewähr):

Delphi-Quellcode:
// uses StrUtils
procedure OptimizePathList (aSource, aTarget: TStrings);
var
  i, j : Integer;
  Path : string;
begin
  aTarget.Clear;
  for i := 0 to aSource.Count - 1 do
    begin
      Path := ExpandUNCFileName(aSource[i]);
      if (path = '') then
//        Exit;
        Continue;
      for j := aTarget.Count - 1 downto 0 do
        if AnsiStartsText(aTarget[j], Path) then
          begin
            Path := '';
            Break;
          end
        else
          if AnsiStartsText(Path, aTarget[j]) then
            aTarget.Delete(j);
      if (Path <> '') then
        aTarget.Add(Path);
    end;
end;
// Edit: Continue statt Exit...

Gruß Hawkeye


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:43 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz