Pascal Scripting: TrimRight

Prototype:

function TrimRight(const S: string): String;

Description:

Trims trailing spaces and control characters from the given string S.