Template:String split: Difference between revisions
(Created page with "<includeonly>{{#invoke:String2 |split |{{{1}}} |{{{2}}} |{{{3}}}}}</includeonly> <noinclude> == Description == This is the '''{{PAGENAME}}''' template. This template is used for listings things with images and an associated short description. It should be transcluded in the following format: <pre> {{String split | <string> | <separator> | <index> }} </pre> Include <code><nowiki>{{clear}}</nowiki></code> after a group of entries, before starting a new section. == Paramet...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{#invoke:String2 |split |{{{1}}} |{{{2}}} |{{{3}}}}}</includeonly> | <includeonly>{{#invoke:String2 |split |{{{1}}}|{{{2}}}|{{{3}}}|true}}</includeonly><noinclude> | ||
<noinclude> | |||
== Description == | == Description == | ||
This is the '''{{PAGENAME}}''' template. This template is | This is the '''{{PAGENAME}}''' template. This template is a wrapper for the <code><nowiki>split</nowiki></code> string2 module function. | ||
It should be transcluded in the following format: | It should be transcluded in the following format: | ||
<pre> | <pre> | ||
{{String split | {{String split|<string>|<separator>|<index>}} | ||
| <string> | |||
| <separator> | |||
| <index> | |||
}} | |||
</pre> | </pre> | ||
Include <code><nowiki>{{clear}}</nowiki></code> after a group of entries, before starting a new section. | Include <code><nowiki>{{clear}}</nowiki></code> after a group of entries, before starting a new section. | ||
Line 20: | Line 15: | ||
== Example == | == Example == | ||
<pre> | <pre> | ||
{{String split | {{String split|This is a piece of text to be split|" "|4}} | ||
| This is a piece of text to be split | |||
| " " | |||
| 4 | |||
}} | |||
</pre> | </pre> | ||
{{String split | {{String split|This is a piece of text to be split|" "|4}} | ||
| This is a piece of text to be split | |||
| " " | |||
| 4 | |||
}} | |||
</noinclude> | </noinclude> |
Latest revision as of 13:51, 19 September 2024
Description
This is the String split template. This template is a wrapper for the split
string2 module function.
It should be transcluded in the following format:
{{String split|<string>|<separator>|<index>}}
Include {{clear}}
after a group of entries, before starting a new section.
Parameters
- 1 (unnamed parameter)
- Required. String to be split.
- 2 (unnamed parameter)
- Required. Separator to split the string by (eg. " ", , , /, :, etc.).
- 3 (unnamed parameter)
- Required. Output index id (starting at 1).
Example
{{String split|This is a piece of text to be split|" "|4}}
piece