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

Content deleted Content added
left: Add mentions of Perl 6
length: Add Perl 6 sections and examples
Line 1,586:
| <code>length(''string'')</code>
| <code></code>
|[[Ingres (database)|Ingres]], [[Perl 5]], [[Pascal (programming language)|Pascal]], [[Object Pascal]] ([[Delphi (programming language)|Delphi]]), [[Rexx]], [[Seed7]], [[SQL]], [[PL/I]]
|-
| <code>[[Len (programming)|len]](''string'')</code>
Line 1,603:
|Number of 16-bit [[UTF-16]]-encoded blocks
|[[Visual Basic .NET|VB .NET]], [[C Sharp (programming language)|C#]], [[Windows PowerShell]], [[F Sharp (programming language)|F#]]
|-
| <code>chars(''string'')</code> <br /> <code>''string''.chars</code>
|Number of graphemes (NFG)
|[[Perl 6]]
|-
| <code>codes(''string'')</code> <br /> <code>''string''.codes</code>
|Number of Unicode code points
|[[Perl 6]]
|-
| <code>''string''.size OR ''string''.length</code>
Line 1,712 ⟶ 1,720:
 
<syntaxhighlight lang="perl">
# Examples in Perl 5
length("hello"); # returns 5
length(""); # returns 0
</syntaxhighlight>
 
<syntaxhighlight lang="perl6">
# Examples in Perl 6
"🏳️‍🌈".chars; chars "🏳️‍🌈"; # both return 1
"🏳️‍🌈".codes; codes "🏳️‍🌈"; # both return 4
"".chars; chars ""; # both return 0
"".codes; codes ""; # both return 0
</syntaxhighlight>