Utf8.codes: Difference between revisions
From GiderosMobile
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
'''Available since:''' Gideros 2016.06<br/> | '''Available since:''' Gideros 2016.06<br/> | ||
=== Description === | === Description === | ||
Returns values so that the construction | <translate>Returns values so that the construction | ||
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. | 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"> | <source lang="lua"> | ||
(iterator) = utf8.codes(s) | (iterator) = utf8.codes(s) | ||
</source> | </source> | ||
=== Parameters === | === Parameters === | ||
'''s''': (string) | '''s''': (string) <translate></translate> <br/> | ||
=== Return values === | === Return values === | ||
'''Returns''' (iterator) iterator<br/> | '''Returns''' (iterator) <translate>iterator</translate><br/> | ||
Revision as of 12:34, 23 August 2018
Available since: Gideros 2016.06
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.
(iterator) = utf8.codes(s)
Parameters
s: (string)
Return values
Returns (iterator) iterator