Template:String split: Difference between revisions

From FHX Wiki
No edit summary
Line 19: Line 19:
== Example ==
== Example ==
<pre>
<pre>
{{String split|This is a piece of text to be split|" "|4}}
{{String split
|This is a piece of text to be split
|" "
|4
}}
</pre>
</pre>
{{String split|This is a piece of text to be split|" "|4}}
{{String split
|This is a piece of text to be split
|" "
|4
}}


</noinclude>
</noinclude>

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
}}