Template:TitleParts/MoveItemToEnd
From A KoL Wiki
[edit]
{{#ifexpr:{{{2|-1}}}<0 or {{{2|-1}}}>={{Template:TitleParts/SizeOf|{{{1|}}}<!-- -- -->}} or {{Template:TitleParts/SizeOf|{{{1|}}}<!-- -- -->}}<=1<!--end expr -->|{{{1|}}}|<!--start else-->{{Template:TitleParts/Splice|{{{1|A/B/C/D}}}|{{{2|0}}}|1}}/{{#titleparts:{{{1|A/B/C/D}}}|1|{{#expr:{{{2|0}}}+1}}}}<!--end else-->}}
This is a helper template used for moving an array element in an array to the end using the #titleparts syntax.
Example
- {{Template:TitleParts/MoveItemToEnd|A/B/C/D|0}}
- B/C/D/A
- {{Template:TitleParts/MoveItemToEnd|A/B/C/D|1}}
- A/C/D/B
- {{Template:TitleParts/MoveItemToEnd|A/B/C/D|2}}
- A/B/D/C
- {{Template:TitleParts/MoveItemToEnd|A/B/C/D|3}}
- A/B/C/D
Limitations
Do note that data expressed with #titleparts is very limited. For a number of reasons:
- The data has a 255 character limit since #titleparts was designed to work with your address bar. If your string exceed 255 characters #titleparts will simply toss the inputted string back at you.
- There can only be 25 slashes in the string. Any more will be ignored and the last element will contain the rest of the string. (You can get around this limitation by nesting #titleparts calls)
- The first character of the string will be changed to uppercase if not already.
More Info
For more information on #titleparts, check the "ParserFunctions" section of your MediaWiki manual.