In Cool§

See primary documentation in context for routine trim-trailing

sub trim-trailing(Str(Cool))
method trim-trailing()

Coerces the invocant (or in sub form, its argument) to Str, and returns the string with trailing whitespace stripped.

my $stripped = '  abc '.trim-trailing;
say "<$stripped>";          # OUTPUT: «<  abc>␤»

In Str§

See primary documentation in context for method trim-trailing

method trim-trailing(Str:D: --> Str)

Removes the whitespace characters from the end of a string. See also trim.

In Allomorph§

See primary documentation in context for method trim-trailing

method trim-trailing(Allomorph:D:)

Calls Str.trim-trailing on the invocant's Str value.