Logo

Programming-Idioms

History of Idiom 169 > diff from v112 to v113

Edit summary for version 113 by programming-idioms.org:
[Lua] The utf8 module is new in Lua 5.3

Version 112

2022-08-18, 22:40:00

Version 113

2022-08-29, 07:53:45

Idiom #169 String length

Assign to the integer n the number of characters of the string s.
Make sure that multibyte characters are properly handled.
n can be different from the number of bytes of s.

Idiom #169 String length

Assign to the integer n the number of characters of the string s.
Make sure that multibyte characters are properly handled.
n can be different from the number of bytes of s.

Variables
n,s
Variables
n,s
Extra Keywords
size characters chars number runes
Extra Keywords
size characters chars number runes
Code
local n = utf8.len(s)
Code
local n = utf8.len(s)
Comments bubble
The utf8 module is new in Lua 5.3
Doc URL
https://www.lua.org/manual/5.3/manual.html#pdf-utf8.len
Doc URL
https://www.lua.org/manual/5.3/manual.html#pdf-utf8.len