Type Function Library utf8.* Return value Numbers Revision Release 2024.3703 Keywords utf8, UTF-8, Unicode, string, codepoint
Returns the code points (as integers) from all characters in a string that start between two byte positions (both included).
The default for end
is the number of characters in the string. This function raises an error if it finds an invalid byte sequence.
utf8.codepoint( s [, start [, end]] )
String. The string to examine.
Number. Starting position. Default is 1
.
Number. Ending position. Default is the number of characters in the string.
local utf8 = require( "plugin.utf8" ) local testStr = "♡ 你好,世界 ♡" print( utf8.codepoint( testStr, 1, 5 ) ) --> 9825 32 20320