Template:Item: Difference between revisions

From DBpedia Mappings
Jump to navigationJump to search
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#replace:{{#explode:{{{1}}}|,|{{{2}}}}}|\|}}<noinclude>
<includeonly>{{#replace:{{#explode:{{{1|}}}|,|{{{2|}}}}}|\|}}<!-- Note: #explode escapes some chars with backslashes, so we #replace backslashes by nothing --></includeonly><noinclude>
Selects an item from a list. The list is a string containing items separated by commas. It is the first parameter. The second parameter is the zero-based index of the item.
Selects an item from a list. The first parameter is the list - a string containing items separated by commas. The second parameter is the zero-based index of the item. Negative indexes start from the end of the list.


Example: '''<nowiki>{{item|a,b,c|1}}</nowiki>''' results in '''b'''.</noinclude>
Examples:
 
* '''<nowiki>{{item|a,b,c,d|1}}</nowiki>''' results in '''b'''
* '''<nowiki>{{item|a,b,c,d|-2}}</nowiki>''' results in '''c'''
 
Also check out the [[Template:Item/test|tests]].
</noinclude>

Latest revision as of 08:36, 15 March 2012

Selects an item from a list. The first parameter is the list - a string containing items separated by commas. The second parameter is the zero-based index of the item. Negative indexes start from the end of the list.

Examples:

  • {{item|a,b,c,d|1}} results in b
  • {{item|a,b,c,d|-2}} results in c

Also check out the tests.