Utf8.codes: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "<source" to "<syntaxhighlight"
Line 7: Line 7:
for p, c in utf8.codes(s) do body end
for p, c in utf8.codes(s) do body end
will iterate over all characters in string s, with p being the position (in bytes) and c the code point of each character. It raises an error if it meets any invalid byte sequence.</translate>
will iterate over all characters in string s, with p being the position (in bytes) and c the code point of each character. It raises an error if it meets any invalid byte sequence.</translate>
<source lang="lua">
<syntaxhighlight lang="lua">
(iterator) = utf8.codes(s)
(iterator) = utf8.codes(s)
</source>
</source>

Revision as of 13:32, 13 July 2023


Available since: Gideros 2016.06
Class: utf8

Description

Returns values so that the construction for p, c in utf8.codes(s) do body end will iterate over all characters in string s, with p being the position (in bytes) and c the code point of each character. It raises an error if it meets any invalid byte sequence. <syntaxhighlight lang="lua"> (iterator) = utf8.codes(s) </source>

Parameters

s: (string)

Return values

Returns (iterator) iterator