Mega Code Archive

 
Categories / Delphi / Files
 

Ensure that a path name ends with a delimiter

{ For People (as I am) who can't manage with all of this function names and forget some "jewels". You should sometimes "rename" such procedures if it helps you to remember. } { Die Unit Sysutils verbirgt einige Funktionen, die oft in Vergessenheit geraten. Kapselt die Funktion aus "Sysutils" in einer Funktion mit einem "ansprechenden" Namen. } { IncludeTrailingBackslash } // Adds '\' to the end of a string if it is not already there. // Die Funktion gibt einen Pfadnamen mit dem abschließenden Zeichen '\' zurück. function CheckPfadEnd(const P: string): string; begin Result := IncludeTrailingBackslash(P); end; { ExcludeTrailingBackslash } // Removes one '\' from the end of a string if it is there. // Die Funktion gibt einen Pfadnamen ohne das abschließende Zeichen \ zurück. MyDir := ExcludeTrailingBackslash('c:\Windows\'); // ---> MyDir = c:\Windows