Template:Str sub new/doc
Jump to navigation
Jump to search
{{#invoke:Message box|mbox}} {{#invoke:Lua banner|main}}
Selects a sub-string from the target string based on selected indices. The indices are 1-based. If the end index is omitted, it returns the rest of the string. One can also specify negative indices, in which case the substr is selected by counting from the end of the string.
Usage
{{str sub ×new|target_string|start_index|end_index}}
- {{str sub new|1234567890|3|7}} = {{safesubst:#invoke:String|sub|s=1234567890|i=3|j=7|no_category=}}
- {{str sub new|1234567890|3|-3}} = {{safesubst:#invoke:String|sub|s=1234567890|i=3|j=-3|no_category=}}
- {{str sub new|1234567890|3}} = {{safesubst:#invoke:String|sub|s=1234567890|i=3|j=-1|no_category=}}
- {{str sub new|1234567890|12}} = {{safesubst:#invoke:String|sub|s=1234567890|i=12|j=-1|no_category=1}}
See also
- {{str sub}}
{{#invoke:Navbox|navbox}}