String length: Difference between revisions

Content added Content deleted
(→‎{{header|Nim}}: use common examples)
m (→‎{{header|Zig}}: format: split output from code)
Line 3,947: Line 3,947:
const string4: []const u8 = "J\u{332}o\u{332}s\u{332}e\u{301}\u{332}";
const string4: []const u8 = "J\u{332}o\u{332}s\u{332}e\u{301}\u{332}";
try printResults(arena, string4);
try printResults(arena, string4);
// utf8 codepoints = 13, bytes = 13
// utf16 codepoints = 13, bytes = 26
// utf8 codepoints = 5, bytes = 7
// utf16 codepoints = 5, bytes = 10
// utf8 codepoints = 7, bytes = 28
// utf16 codepoints = 7, bytes = 28
// utf8 codepoints = 9, bytes = 14
// utf16 codepoints = 9, bytes = 18
}</syntaxhighlight>
}</syntaxhighlight>

{{out}}

<pre>
utf8 codepoints = 13, bytes = 13
utf16 codepoints = 13, bytes = 26
utf8 codepoints = 5, bytes = 7
utf16 codepoints = 5, bytes = 10
utf8 codepoints = 7, bytes = 28
utf16 codepoints = 7, bytes = 28
utf8 codepoints = 9, bytes = 14
utf16 codepoints = 9, bytes = 18
</pre>