Skip to content

Commit a2b0e77

Browse files
committed
Str.starts-with
1 parent 796181f commit a2b0e77

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Type/Str.pod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,15 @@ Special case: sprintf("<b>%s</b>\n", "Perl 6") will not work use either of the
336336
sprintf "<b>\%s</b>\n", "Perl 6";
337337
sprintf "<b>%s\</b>\n", "Perl 6";
338338
339+
=head2 method starts-with
340+
341+
multi method starts-with(Str:D: Str(Cool) $needle) returns True:D
342+
343+
Returns True if the invocant is identical to or starts with C<$needle>.
344+
345+
say "Hello, World".starts-with("Hello"); # True
346+
say "http://perl6.org/".starts-with('ftp'); # False
347+
339348
=head2 method subst
340349
341350
multi method subst(Str:D: $matcher, $replacement, *%opts)

0 commit comments

Comments
 (0)