Utf8.len

From GiderosMobile
Revision as of 20:36, 1 December 2023 by MoKaLux (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2016.06
Class: utf8

Description

Returns the number of UTF-8 characters in string s that start between positions i and j (both inclusive).

(number) = utf8.len(s,i,j)

The default for i is 1 and for j is -1. If it finds any invalid byte sequence, returns a false value plus the position of the first invalid byte.

Parameters

s: (string) string
i: (number) start at position optional
j: (number) end at position optional

Return values

Returns (number) number of characters

Example

local str = "Hélène"
local str_length = utf8.len(str)