Type Library Revision 2017.3060 Keywords utf8, UTF-8, Unicode, string Platforms Android, iOS, macOS, tvOS, Windows
The UTF-8 plugin, based on the luautf8 module, provides functions to manipulate
UTF-8 strings are composed of a mixture of
Essentially, if you need to handle actions like
The UTF-8 plugin uses some concepts which should be understood before attempting to use it.
character position or charpos — The position of a character in the
offset or offset — The number of characters that one character is from another. This may depend on the characters which exist between the two points.
code point or codepoint — Number which represents the character at a particular charpos. It is the Unicode standard code for that character.
local utf8 = require( "plugin.utf8" )
In addition, the following functions mimic the respective string library functions except, in the
| UTF-8 Plugin | Equivalent |
|---|---|
utf8.byte |
string.byte() |
utf8.char |
string.char() |
utf8.find |
string.find() |
utf8.gmatch |
string.gmatch() |
utf8.gsub |
string.gsub() |
utf8.len |
string.len() |
utf8.lower |
string.lower() |
utf8.match |
string.match() |
utf8.reverse |
string.reverse() |
utf8.sub |
string.sub() |
utf8.upper |
string.upper() |
To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.
settings =
{
plugins =
{
["plugin.utf8"] =
{
publisherId = "com.coronalabs"
},
},
}