IncludeTrailingBackslash function
String / Filename routines
Return to Introduction  Previous page  Next page
Unit
acUtils  

Declaration
function IncludeTrailingBackslash(St: String): String;  

Description
The IncludeTrailingBackslash function puts a backslash '\' at the end of a string (i.e: file path) if it's not already there. For example result of IncludeTrailingBackslash('c:\windows') will be "c:\windows\". It's a typical function that gets rewritten by every programmer.  

Note
This function used in the AppControls for Delphi 2/3/4 and BCB 1/3/4 only. In the Delphi 5 and later please use same routine from standard SysUtils unit.  

Original code
function IncludeTrailingBackslash(const St: String): String;  
begin  
 if (St = ''or (St[Length(St)] <> '\'then  
   Result := St + '\'  
 else  
   Result := St;  
end;