Utf8.codes: Difference between revisions

From GiderosMobile
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
'''<translate>Available since</translate>:''' Gideros 2016.06<br/>
'''Available since:''' Gideros 2016.06<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/utf8|utf8]]<br/>
'''Class:''' [[utf8]]<br/>
=== <translate>Description</translate> ===
 
<translate>Returns values so that the construction
=== Description ===
for p, c in utf8.codes(s) do body end
Returns values so that the construction
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>
'''for p, c in utf8.codes(s) do body end'''
<source lang="lua">
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)
(iterator) = utf8.codes(s)
</source>
</syntaxhighlight>
=== <translate>Parameters</translate> ===
 
'''s''': (string) <translate></translate> <br/>
=== Parameters ===
=== <translate>Return values</translate> ===
'''s''': (string) <br/>
'''<translate>Returns</translate>''' (iterator) <translate>iterator</translate><br/>
 
=== Return values ===
'''Returns''' (iterator) iterator<br/>
 
{{Utf8}}

Latest revision as of 20: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