starts-with
ErrorsCollection

starts-with

Synthesised documentation from type/Str

From type/Str

See Original text in context

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

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

say "Hello, World".starts-with("Hello");     # OUTPUT: «True␤» 
say "https://raku.org/".starts-with('ftp');  # OUTPUT: «False␤»

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".starts-with("hello");              # OUTPUT: «False␤» 
say "Hello, World".starts-with("hello":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".starts-with("ä");              # OUTPUT: «False␤» 
say "abc".starts-with("ä":ignoremark); # OUTPUT: «True␤»