formatStrProp: Difference between revisions
Jump to navigation
Jump to search
(New page: ==Function formatStrProp== Returns a custom-formatted version of the property string. ===Usage=== <source lang="mtmacro" line> [h: formatStrProp(props, listFormat, entryFormat, separator)...) |
Verisimilar (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
= | {{MacroFunction | ||
Returns a custom-formatted version of the property string. | |name=formatStrProp | ||
|description=Returns a custom-formatted version of the property string. | |||
|usage= | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: formatStrProp(props, listFormat, entryFormat, separator) ] | [h: formatStrProp(props, listFormat, entryFormat, separator) ] | ||
Line 10: | Line 11: | ||
* separator is emitted in between the formatted items. | * separator is emitted in between the formatted items. | ||
|example= | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: props = "Strength=14 ; Constitution=8 ; Dexterity=13 ; Intelligence=4 ; Wisdom=18 ; Charisma=9"] | [h: props = "Strength=14 ; Constitution=8 ; Dexterity=13 ; Intelligence=4 ; Wisdom=18 ; Charisma=9"] | ||
[formatStrProp(props, "<table border=1>%list</table>", "<tr> <td><b>%key</b></td> <td>%value</td> </tr>", "")] | [formatStrProp(props, "<table border=1>%list</table>", "<tr> <td><b>%key</b></td> <td>%value</td> </tr>", "")] | ||
</source> | </source> | ||
(prints settings in a formatted table): | (prints settings in a formatted table) | ||
}} | |||
[[Category:String Property List Function]] |
Revision as of 02:35, 7 March 2009
formatStrProp() Function
Returns a custom-formatted version of the property string.
Usage
[h: formatStrProp(props, listFormat, entryFormat, separator) ]
- listFormat is a string that is emitted once. It should contain the text "%list", which is replaced with the formatted items.
- entryFormat is emitted once per item. Any instances of "%key" and "%value" in the string are replaced with the key or value for that setting.
- separator is emitted in between the formatted items.
Example
[h: props = "Strength=14 ; Constitution=8 ; Dexterity=13 ; Intelligence=4 ; Wisdom=18 ; Charisma=9"]
[formatStrProp(props, "<table border=1>%list</table>", "<tr> <td><b>%key</b></td> <td>%value</td> </tr>", "")]