string.ulen(str)function
Gets the length in characters of the provided UTF8 string.
Parameters
str
The UTF8 string whose length will be returned
Return value
Returns the number of characters.Example
-- declare an UTF8 string (file must be saved with UTF8 encoding)
local summer_in_french = "été"
-- outputs 5 (in bytes)
print( #summer_in_french )
-- outputs 5 (in bytes)
print( string.len(summer_in_french) )
-- outputs 3 (in characters)
print( summer_in_french:ulen() )