Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
3
Task/String-matching/Raku/string-matching-1.raku
Normal file
3
Task/String-matching/Raku/string-matching-1.raku
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$haystack.starts-with($needle) # True if $haystack starts with $needle
|
||||
$haystack.contains($needle) # True if $haystack contains $needle
|
||||
$haystack.ends-with($needle) # True if $haystack ends with $needle
|
||||
3
Task/String-matching/Raku/string-matching-2.raku
Normal file
3
Task/String-matching/Raku/string-matching-2.raku
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
so $haystack ~~ /^ $needle / # True if $haystack starts with $needle
|
||||
so $haystack ~~ / $needle / # True if $haystack contains $needle
|
||||
so $haystack ~~ / $needle $/ # True if $haystack ends with $needle
|
||||
2
Task/String-matching/Raku/string-matching-3.raku
Normal file
2
Task/String-matching/Raku/string-matching-3.raku
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
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
|
||||
2
Task/String-matching/Raku/string-matching-4.raku
Normal file
2
Task/String-matching/Raku/string-matching-4.raku
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$haystack.match($needle, :g)».from; # List of all positions where $needle appears in $haystack
|
||||
$haystack.indices($needle :overlap); # Also find any overlapping instances of $needle in $haystack
|
||||
Loading…
Add table
Add a link
Reference in a new issue