RosettaCodeData/Task/String-matching/Perl-6/string-matching-3.pl6

3 lines
174 B
Raku

substr($haystack, 0, $needle.chars) eq $needle # True if $haystack starts with $needle
substr($haystack, *-$needle.chars) eq $needle # True if $haystack ends with $needle