ends-with
ErrorsCollection

ends-with

Synthesised documentation from type/Str

From type/Str

See Original text in context

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 upper case, lower case and title case 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␤»