Logo

Programming-Idioms

History of Idiom 169 > diff from v31 to v32

Edit summary for version 32 by Kng:
[Lua] Realized I can split the 2 implementations

Version 31

2018-04-03, 08:05:09

Version 32

2018-04-03, 08:07:08

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

Extra Keywords
size
Extra Keywords
size
Code
local n = utf8.len(s)
Code
local n = utf8.len(s)
Comments bubble
You can also use #s to get the amount of bytes
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