Documentation for method ends-with assembled from the following pages:
Class: Str §
From Str
(Str) method ends-with §
multi method ends-with(Str: Str(Cool) , :i(:), :m(:) --> Bool)
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»