Compare length of two strings: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Raku}}: add another encoding for comparison) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: more accurate terminology) |
||
Line 17: | Line 17: | ||
<lang perl6>say 'Strings (👨👩👧👦, 🇺🇸, BOGUS!) sorted: "longest" first:'; |
<lang perl6>say 'Strings (👨👩👧👦, 🇺🇸, BOGUS!) sorted: "longest" first:'; |
||
say "$_: characters:{.chars}, |
say "$_: characters:{.chars}, Unicode code points:{.codes}, UTF-8 bytes:{.encode('UTF8').bytes}, UTF-16 bytes:{.encode('UTF16').bytes}" for <👨👩👧👦 BOGUS! 🇺🇸>.sort: -*.chars;</lang> |
||
{{out}} |
{{out}} |
||
<pre>Strings (👨👩👧👦, 🇺🇸, BOGUS!) sorted: "longest" first: |
<pre>Strings (👨👩👧👦, 🇺🇸, BOGUS!) sorted: "longest" first: |
||
BOGUS!: characters:6, |
BOGUS!: characters:6, Unicode code points:6, UTF-8 bytes:6, UTF-16 bytes:12 |
||
👨👩👧👦: characters:1, |
👨👩👧👦: characters:1, Unicode code points:7, UTF-8 bytes:25, UTF-16 bytes:22 |
||
🇺🇸: characters:1, |
🇺🇸: characters:1, Unicode code points:2, UTF-8 bytes:8, UTF-16 bytes:8</pre> |
||
=={{header|Z80 Assembly}}== |
=={{header|Z80 Assembly}}== |