How to remove string trailing path separator in Pascal

1 Answer

0 votes
program RemoveTrailingPathSeparator;

uses
  SysUtils; // ExcludeTrailingPathDelimiter

var
  Path: string;
  CleanedPath: string;
begin
  Path := 'C:\MyFolder\Project\'; // Example with a trailing path separator
  
  CleanedPath := ExcludeTrailingPathDelimiter(Path);
  
  WriteLn(CleanedPath);
end.



(*
run:

C:\MyFolder\Project

*)

 



answered Jun 16, 2025 by avibootz
...