lua-users home
lua-l archive

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


> What does #str (the string length operator) return?

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

What does "character" mean in Lua RT?
Does string.length() return the number of unicode codepoints or the number of UTF-16 words?
I'm asking because Windows internally works with UTF16-encoded strings.

What about positions (pos1...pos4) in
string.sub(str, pos1, pos1)
pos2 = string.find(str, "()%w", pos3)
string.byte(str, pos4)
Are they byte positions or character positions?