whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1547)

Database (90)
Files (137)
Forms (107)
Graphic (115)
IDE (21)
Indy (5)
Internet / LAN (131)
IntraWeb (0)
Math (76)
Misc (127)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (268)
VCL (243)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

34 Visitors Online


 
...ensure that a path name ends with a delimiter '\' ?
Autor: Loïs Bégué
Homepage: http://www.begue.de
[ Print tip ]  

Tip Rating (7):  
     


{
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


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners