Compare length of two strings: Difference between revisions
m
→{{header|Raku}}: added emphasis
Thundergnat (talk | contribs) m (→{{header|Raku}}: typo) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: added emphasis) |
||
Line 14:
So... In what way does this task differ significantly from [[String length]]? Other than being horribly under specified?
In the modern world, string "length" is pretty much a useless measurement, especially in the absence of a specified encoding; hence Raku not even having an operator: "length" for strings.
<lang perl6>say 'Strings (👨👩👧👦,
say "$_: characters:{.chars}, Unicode code points:{.codes}, UTF-8 bytes:{.encode('UTF8').bytes}, UTF-16 bytes:{.encode('UTF16').bytes}" for <👨👩👧👦 BOGUS!
{{out}}
<pre>Strings (👨👩👧👦,
BOGUS!: characters:6, Unicode code points:6, UTF-8 bytes:6, UTF-16 bytes:12
=={{header|Z80 Assembly}}==
|