Anonymous user
String length: Difference between revisions
Merged the two programs in a single one. Added output.
No edit summary |
(Merged the two programs in a single one. Added output.) |
||
Line 2,076:
=={{header|Nim}}==
In Nim, <code>len</code> returns the byte length of strings, ignoring the UTF-8 encoding. When dealing with Unicode strings, the module <code>unicode</code> must be used.
<lang Nim>
echo '"',s, '"'," has byte length: ", len(s)▼
echo &"“{s}” has Unicode char length {s.runeLen}."</lang>
{{out}}
# -> "Hello, world! ☺" has unicode char length: 15</lang>▼
<pre>“Hello, world! ☺” has byte length 17.
=={{header|Oberon-2}}==
|