Ensure that a path name ends with a delimiter ‘\’ in delphi

// 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.
}

{ IncludeTrailingBackslash }

// Adds ‘\’ to the end of a string if it is not already there.

function CheckPfadEnd(const P: string): string;
begin
Result := IncludeTrailingBackslash(P);
end;

{ ExcludeTrailingBackslash }

// Removes one ‘\’ from the end of a string if it is there.

MyDir := ExcludeTrailingBackslash(‘c:\Windows\’);
// —> MyDir = c:\Windows