utf8.charpos
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
Converts the UTF-8 codepoint position to byte-string position.
Note
Code point characters beyond the byte value range (0-127) require at least 2 bytes to represent the character
Syntax
utf8.charpos ( )Code Examples
server
This example takes the second codepoint character and shows the byte-string position and the codepoint character code.
local position, codepoint = utf8.charpos( "Привет", 2 )print( position, codepoint ) -- 3, 1088