listFormat: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Applied Template:MacroFunction)
Line 1: Line 1:
==Function assert==
{{MacroFunction
|name=listFormat
|description=
Returns a custom-formatted version of the list.
Returns a custom-formatted version of the list.


===Usage===
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[ listFormat(list, listFormat, itemFormat, separator) ]
[ listFormat(list, listFormat, itemFormat, separator) ]
Line 11: Line 13:
* separator is emitted in between the formatted items.
* separator is emitted in between the formatted items.


====Example====
|example=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[ listFormat("apple,bear,cat", "BEGIN LIST<br>%list<br>END LIST", "This item is: %item", "<br>") ]
[ listFormat("apple,bear,cat", "BEGIN LIST<br>%list<br>END LIST", "This item is: %item", "<br>") ]
</source>
</source>
(prints items on separate lines)
(prints items on separate lines)
}}
[[Category:String List Function]]

Revision as of 02:49, 9 March 2009

listFormat() Function

Returns a custom-formatted version of the list.

Usage

[ listFormat(list, listFormat, itemFormat, separator) ]
[ listFormat(list, listFormat, itemFormat, separator, delim) ]
  • listFormat is a string that is emitted once. It should contain the text "%list", which is replaced with the formatted items.
  • itemFormat is emitted once per item. Each instance of "%item" in the string is replaced with the value of the list item.
  • separator is emitted in between the formatted items.

Example

[ listFormat("apple,bear,cat", "BEGIN LIST<br>%list<br>END LIST", "This item is: %item", "<br>") ]
(prints items on separate lines)