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:
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.replace (str, pattern, replacement)
-
Performs plain substring substitution, with no characters in
pattern
orreplacement
being considered magic.Parameters:
Returns:
See also:
Usage:
assert(string.replace('Dot.percent.arent.magic', '.', '%') == 'Dot%percent%arent%magic')