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

Declaration
function ExcludeTrailingBackslash(St: String): String;  

Description
The ExcludeTrailingBackslash function removes a backslashes '\' from the end of string (i.e: file path). For example result of ExcludeTrailingBackslash('c:\windows\') will be "c:\windows".  

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 ExcludeTrailingBackslash(const St: String): String;  
begin  
  Result := St;  
  while (Result <> ''and (Result[Length(Result)] = '\'do  
   SetLength(Result, Length(Result) - 1);  
end;