Class System.UTF8

UTF-8 library class.

Provides UTF-8 aware string functions implemented in pure lua.

All functions behave as their non UTF-8 aware counterparts with the exception that UTF-8 characters are used instead of bytes for all units.

Methods

System.UTF8:byte (s[, i=1[, j=i]]) string.byte equivalent for UTF-8 strings.
System.UTF8:char (...) string.char equivalent for UTF-8 strings.
System.UTF8:find (s, pattern[, init[, plain]]) string.find equivalent for UTF-8 strings.
System.UTF8:gmatch (s, pattern[, all]) string.gmatch equivalent for UTF-8 strings.
System.UTF8:gsub (s, pattern, repl[, n]) string.gsub equivalent for UTF-8 strings.
System.UTF8:len (s) string.len equivalent for UTF-8 strings.
System.UTF8:match (s, pattern[, init]) string.match equivalent for UTF-8 strings.
System.UTF8:sub (s, i[, j]) string.sub equivalent for UTF-8 strings.
System.UTF8:reverse (s) string.reverse equivalent for UTF-8 strings.
System.UTF8:codes (s) Returns an iterator which iterate over all characters in string s, with p being the position (in bytes) and c the code point of each character.
System.UTF8:gensub (s[, len=1]) Returns an iterator which returns the next substring and its byte interval.
System.UTF8.explode (source, delimiter) string.explode equivalent for UTF-8 strings.


Methods

System.UTF8:byte (s[, i=1[, j=i]])
string.byte equivalent for UTF-8 strings.

Parameters:

  • s string
  • i number (default 1)
  • j number (default i)

Returns:

    ... Char codes in lua number.
System.UTF8:char (...)
string.char equivalent for UTF-8 strings.

Parameters:

  • ... UTF-8 code integers.

Returns:

    string
System.UTF8:find (s, pattern[, init[, plain]])
string.find equivalent for UTF-8 strings.

Parameters:

  • s string
  • pattern string
  • init number (optional)
  • plain boolean (optional)

Returns:

    find result.
System.UTF8:gmatch (s, pattern[, all])
string.gmatch equivalent for UTF-8 strings.

Parameters:

Returns:

    function
System.UTF8:gsub (s, pattern, repl[, n])
string.gsub equivalent for UTF-8 strings.

Parameters:

Returns:

    string
System.UTF8:len (s)
string.len equivalent for UTF-8 strings.

Parameters:

Returns:

    number
System.UTF8:match (s, pattern[, init])
string.match equivalent for UTF-8 strings.

Parameters:

Returns:

    match result.
System.UTF8:sub (s, i[, j])
string.sub equivalent for UTF-8 strings.

Parameters:

  • s string
  • i number
  • j number (optional)

Returns:

    string
System.UTF8:reverse (s)
string.reverse equivalent for UTF-8 strings.

Parameters:

Returns:

    string
System.UTF8:codes (s)
Returns an iterator which iterate over all characters in string s, with p being the position (in bytes) and c the code point of each character.

Parameters:

Returns:

    function Returns variable (p, c).
System.UTF8:gensub (s[, len=1])
Returns an iterator which returns the next substring and its byte interval.

Parameters:

  • s string
  • len number The string length of each substrings. (default 1)

Returns:

    function Returns variable (substring, startPos, endPos).
System.UTF8.explode (source, delimiter)
string.explode equivalent for UTF-8 strings.

Parameters:

  • source string The string to explode.
  • delimiter string The string delimiter.

Returns:

    table The result.
generated by LDoc 1.4.6 Last updated 2020-06-15 21:15:36