Modèle:Splitter : Différence entre versions
Sauter à la navigation
Sauter à la recherche
(Page créée avec « {{#if: {{#titleparts: {{{1|}}}|1|1}} | {{{3|}}}{{#titleparts: {{{1|}}}|1|1}}{{{4|}}} }}{{#if: {{#titleparts: {{{1|}}}|1|2}} | {{{2| }}}{{{3|}}}{{#titleparts: {{... ») |
|||
Ligne 17 : | Ligne 17 : | ||
}}{{#if: {{#titleparts: {{{1|}}}|1|9}} | }}{{#if: {{#titleparts: {{{1|}}}|1|9}} | ||
| {{{2| }}}{{{3|}}}{{#titleparts: {{{1|}}}|1|9}}{{{4|}}} | | {{{2| }}}{{{3|}}}{{#titleparts: {{{1|}}}|1|9}}{{{4|}}} | ||
− | }}<noinclude>{{Splitter/doc}}[[Category: | + | }}<noinclude>{{Splitter/doc}}[[Category:Modèle (Soutien)]]</noinclude> |
Version actuelle datée du 20 mai 2013 à 14:44
This is a quick and dirty string manipulator with limited capabilities. It can probably be replaced by something more robust using some StringFunctions like explode. For now, though....
- Takes up to four parameters, as follows:
- A string to be split. This must be in the form of several items separated by backslashes. For example,
Man/Hobbit/Elf
. - A separator string. The default value is a nonbreaking space, but this can be any combination of spaces and characters; this will be inserted between each substirng
- A prefix string. This is added to the beginning of each substring.
- A postfix string. This is added to the end of each substring.
The template will separate the string provided in the first parameter at each backslash (/; using #titleparts and return each substring formatted as instructed by the parameters, up to nine items. This can be useful to perform operations on a given list. For example, this template is used by Template:Infobox Quests to linkify and categorize quests available to more than one (but not all) races (such as Quest:Intro: The Storm is Upon Us).