![]() |
Pfad Formatierung gesucht
Hallo,
ich suche eine Funktion, die folg. macht: Ich habe z.B. einen Pfad: C:\123\456\789\000\test.txt Wenn dieser zu lang wird, soll er so angezeigt werden: C:\123\...\000\test.txt Weiss jemand, wie das geht? Gibt es da eine Systemfunktion? |
Re: Pfad Formatierung gesucht
Hallo,
schau Dir mal aus der Unit filectrl die Funktion MininimizeName(...) an. |
Re: Pfad Formatierung gesucht
Oder versuch mal das hier was ich eben schnell geschrieben habe:
Delphi-Quellcode:
function ShortPath(Path: String; Max: Integer):String;
var sLeft, sRight: String; begin if (Length(Path) > Max) and (Max > 10) then begin while Length(Path) > Max do begin sLeft:= Copy(Path, 1, Pos('\', Path)); sRight := Copy(Path, PosEx('\', Path, Pos('\', Path)+1)+1, Length(Path)); Path := sLeft+sRight; end; Result := sLeft+'...\'+sRight; end else Result := Path; end; Gruß Stormy |
Re: Pfad Formatierung gesucht
Danke für die Lösungen!
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:50 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz