Difference between revisions of "Utf8.codes"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2016.06<br/> === Description === Returns values so that the construction for p, c in utf8.codes(s) do body end will iterate over all c...") |
|||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''Available since:''' Gideros 2016.06<br/> | '''Available since:''' Gideros 2016.06<br/> | ||
+ | '''Class:''' [[utf8]]<br/> | ||
+ | |||
=== Description === | === Description === | ||
Returns values so that the construction | 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. |
− | < | + | <syntaxhighlight lang="lua"> |
− | (iterator) | + | (iterator) = utf8.codes(s) |
− | </ | + | </syntaxhighlight> |
− | '''s | + | |
+ | === Parameters === | ||
+ | '''s''': (string) <br/> | ||
+ | |||
+ | === Return values === | ||
'''Returns''' (iterator) iterator<br/> | '''Returns''' (iterator) iterator<br/> | ||
+ | |||
+ | {{Utf8}} |
Latest revision as of 21:37, 1 December 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.
(iterator) = utf8.codes(s)
Parameters
s: (string)
Return values
Returns (iterator) iterator