pandoc.text

fromencoding

function pandoc.text.fromencoding(s: string, encoding: string)
  -> string

Converts a string to UTF-8. The encoding parameter specifies the encoding of the input string. On Windows, that parameter defaults to the current ANSI code page; on other platforms the function will try to use the file system’s encoding.

See toencoding for more info on supported encodings.

len

function pandoc.text.len(s: string)
  -> integer

Returns the length of a UTF-8 string

lower

function pandoc.text.lower(s: string)
  -> string

Returns a copy of a UTF-8 string, converted to lowercase.

reverse

function pandoc.text.reverse(s: string)
  -> string

Returns a copy of a UTF-8 string, with characters reversed.

sub

function pandoc.text.sub(s: string, first: integer, last?: integer)
  -> string

Returns a substring of a UTF-8 string, using Lua’s string indexing rules.

toencoding

function pandoc.text.toencoding(s: string, encoding: string)
  -> string

Converts a UTF-8 string to a different encoding. The encoding parameter defaults to the current ANSI code page on Windows; on other platforms it will try to guess the file system’s encoding.

The set of known encodings is system dependent, but includes at least UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, and UTF-32LE. Note that the default code page on Windows is available through CP0.

upper

function pandoc.text.upper(s: string)
  -> string

Returns a copy of a UTF-8 string, converted to uppercase.