Module:Ustring/doc
Appearance
![]() | This is a documentation subpage for Module:Ustring. It may contain usage information, categories and other content that is not part of the original module page. |
This module directly imports all functions from the
mw.ustring
library.
The module takes an indefinite number of arguments. All arguments are coerced as number type if possible. If you wish for something to remain a string, you can escape it with \
, which in turn can be escaped by itself.
You can also wrap results in tags. All non-number indexed arguments will be passed to {
frame:extensionTag
Usage
{{#invoke:Ustring|function_name|arg1|arg2|...}}
is equivalent to mw.ustring.function_name
( arg1, arg2, ... )
===Example using
mw.ustring.sub
:===
{{#invoke:Ustring|sub|abcde|2|4}}
produces bcd
===Example using
mw.ustring.gsub
:===
{{#invoke:Ustring|match|abcde|(c%w)}}
produces cd
Example using tag arguments
{{#invoke:Ustring|sub|{{Module:Ustring}}|274|548|tag=pre|style=background-color:#edd}}
produces:
tr_i = 1
while fargs['s' .. str_i] do
fargsused['s' .. str_i] = true
args[str_i] = fargs['s' .. str_i]
str_i = str_i + 1
end
for i, v in ipairs(fargs) do
fargsused[i] = true
args[i + str_i - 1] = tonumber(v) or v:gsub("^\\", "", 1)
end
if n