Module:Ustring/doc

This module directly imports all functions from the library. Documentation for each function can be found there.

The module takes an indefinite number of arguments. Arguments given as s1, s2, etc, are read first, and are used as strings. All remaining numerical arguments are coerced to number type if possible, and remain strings if not. If you wish for a numerical (i.e. unnamed or "1", "2") to remain a string, you can simply escape it by inserting  at the beginning of the string.

Note that MediaWiki will always trim whitespace from named arguments; to give arguments with surrounding whitespace you must use unnamed parameters starting with.

You can also wrap results in tags. All non-number indexed arguments will be passed to

Usage
is equivalent to

Example using mw.ustring.sub
produces:

Example using mw.ustring.gsub
produces:

Example using mw.ustring.char
produces:

&amp;#

Example using mw.ustring.match
produces:

Note: Only the first match is returned. Additional returns are omitted because mw.ustring.gsub's second return value is generally undesirable.

Example using tag arguments
produces:

Note that:

produces:

Errors
Errors from accessing should be maintained, e.g.:

should produce:

and

should produce: