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. |
![]() | The rating is either invalid or not specified. Please remove the {{Module rating}} template or specify a valid rating. |
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:
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}}