Module string_extras

Extra functionality for Lua's string library.

Functions

string.join (sep, ...) Returns a Lua string with all values joined by separator.
string.quote (value) Quote a value, alias for string.format("%q", tostring(value)).
string.replace (str, pattern, replacement) Performs plain substring substitution, with no characters in pattern or replacement being considered magic.


Functions

string.join (sep, ...)
Returns a Lua string with all values joined by separator. tostring is called to each of the passed values before joining.

Parameters:

Returns:

    string

Usage:

    assert(string.join(',', 1, 2, 'three', Array()) == '1,2,three,[]')
string.quote (value)
Quote a value, alias for string.format("%q", tostring(value)).

Parameters:

  • value

Returns:

    string
string.replace (str, pattern, replacement)
Performs plain substring substitution, with no characters in pattern or replacement being considered magic.

Parameters:

Returns:

    string

See also:

Usage:

    assert(string.replace('Dot.percent.arent.magic', '.', '%') == 'Dot%percent%arent%magic')
generated by LDoc 1.4.6 Last updated 2023-01-04 08:52:34