Template:Str sub new
Jump to navigation
Jump to search
Uses Lua: |
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}} = 34567
- {{str sub new|1234567890|3|-3}} = 345678
- {{str sub new|1234567890|3}} = 34567890
- {{str sub new|1234567890|12}} = String Module Error: String subset index out of range
See also
- {{str sub}}
|
The above documentation is transcluded from Template:Str sub new/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |