Sign in Join
FPDoc Onlineexperiment

TrimRight function

In unit sysutils

Trim whitespace from the end of a string.

Declaration

pascal
function TrimRight(const S: ansistring): ansistring

Description

Trim strips blank characters (spaces and control characters) at the end of S and returns the resulting string. All characters with ordinal values less than or equal to 32 (a space) are stripped.

If the string contains only spaces, an empty string is returned.

Errors

None.

See also

Example: ex86

pascal
Program Example86;

{ This program demonstrates the TrimRight function }

Uses sysutils;
{$H+}

Procedure Testit (S : String);

begin
  Writeln ('"',TrimRight(S),'"');
end;

Begin
  Testit ('  ha ha what gets lost ? ');
  Testit (#10#13'haha ');
  Testit ('              ');
End.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.