Comparison of programming languages (string functions): Difference between revisions

Content deleted Content added
Loudogni (talk | contribs)
split: Add Perl 6 snippet
Loudogni (talk | contribs)
substring: Add Perl 5 and Perl 6 snippet
Line 2,816:
string:substr("abc", 2, 1). % returns "b"
string:substr("abc", 2). % returns "bc"
</syntaxhighlight>
 
 
<syntaxhighlight lang="perl">
# Examples in Perl 5
substr("abc", 1, 1); # returns "b"
substr("abc", 1); # returns "bc"
</syntaxhighlight>
 
<syntaxhighlight lang="perl6">
# Examples in Perl 6
"abc".substr(1, 1); # returns "b"
"abc".substr(1); # returns "bc"
</syntaxhighlight>