String length: Difference between revisions
→{{header|Nim}}: use common examples
(→{{header|Julia}}: add Grapheme Length and use suggested examples) |
(→{{header|Nim}}: use common examples) |
||
Line 2,227:
=={{header|Nim}}==
<syntaxhighlight lang="nim">import strformat, unicode▼
===Byte Length===
echo "møøse".len # 7
echo "𝔘𝔫𝔦𝔠𝔬𝔡𝔢".len # 28
echo "J̲o̲s̲é̲".len # 13
</syntaxhighlight>
===Character Length===
<syntaxhighlight lang="nim">
import unicode
echo "møøse".runeLen # 5
echo "𝔘𝔫𝔦𝔠𝔬𝔡𝔢".runeLen # 7
echo "J̲o̲s̲é̲".runeLen # 8
</syntaxhighlight>
===Grapheme Length===
[https://nim-lang.org/docs/unicode.html#graphemeLen%2Cstring%2CNatural graphemeLen()] does not do what you expect. It doesn't return the number of grapheme in a string but returns the number of bytes at a character/codepoint index for a given string.
=={{header|Oberon-2}}==
|