Module:Ustring/doc
Appearance
![]() | This is a documentation subpage for टेम्पलेट:Terminate sentence It may contain usage information, categories and other content that is not part of the original module page. |
![]() | This module is rated as ready for general use. It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
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|gsub|1234|23|}}
produces:
14
Example using mw.ustring.match
{{#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:
local str_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)
Note that:
<pre style=background-color:#edd>{{#invoke:Ustring|sub|{{Module:Ustring}}|274|548}}</pre>
produces:
{{#invoke:Ustring|sub|{{Module:Ustring}}|274|548}}