In Str§

See primary documentation in context for method ends-with

multi method ends-with(Str:D: Str(Cool$needle:i(:$ignorecase), :m(:$ignoremark--> Bool:D)

Returns True if the invocant is identical to or ends with $needle.

say "Hello, World".ends-with('Hello');      # OUTPUT: «False␤» 
say "Hello, World".ends-with('ld');         # OUTPUT: «True␤»

Since Rakudo version 2020.02, if the optional named parameter :ignorecase, or :i, is specified, the comparison of the invocant and $needle ignores the distinction between uppercase, lowercase and titlecase letters.

say "Hello, World".ends-with("world");              # OUTPUT: «False␤» 
say "Hello, World".ends-with("world":ignorecase); # OUTPUT: «True␤»

Since Rakudo 2020.02, if the optional named parameter :ignoremark, or :m, is specified, the comparison of the invocant and $needle only considers base characters, and ignores additional marks such as combining accents.

say "abc".ends-with("ç");              # OUTPUT: «False␤» 
say "abc".ends-with("ç":ignoremark); # OUTPUT: «True␤»