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

3 lines
174 B
Raku
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
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