Number of characters in utf8 string
Posted: Sun Apr 10, 2022 2:04 pm
Any suggestions on how to get the number of displayed characters in a lua string that may contain utf8 chars?
#str & string.len(str) return the number of bytes rather than number of characters.
There is the utf8 string module in lua 5.3, but it's not found in game (not sure if Factorio is still on lua 5.2.x or if it's disabled?).
I'm trying to force some display padding and sorting behaviours.
#str & string.len(str) return the number of bytes rather than number of characters.
There is the utf8 string module in lua 5.3, but it's not found in game (not sure if Factorio is still on lua 5.2.x or if it's disabled?).
I'm trying to force some display padding and sorting behaviours.