lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Le 2021-01-21 08:51, Egor Skriptunoff a écrit :
2) I have tested string.find("Ё", "[А-Я]") in LuaRT : it
returns
correctly 1,2 that means the Ё has been correctly found ?

In fact, it returns 1, 1 (matching the right character).

OK, it's good.

What does #str (the string length operator) return?
- a number of bytes in a string
- a number of UTF16 words (a symbol above U+FFFF is encoded as a
surrogate pair and therefore has length of 2)

- a number of UTF-8 codepoints
- a number of symbols (a symbol may consist of several codepoints)

#str means the size of the string on bytes.
Use string.length to get the length in characters.

Regards,

Samir