formatStrProp

From RPTools Wiki
Jump to navigation Jump to search

formatStrProp() Function

Returns a custom-formatted version of the property string.

Usage

[h: formatStrProp(proplist, listFormat, entryFormat, separator)]
[h: formatStrProp(proplist, listFormat, entryFormat, separator, delim)]

Parameters

  • proplist - String property list to extract data from.
  • listFormat - String that is emitted once. It should contain the text "%list", which is replaced with the formatted items.
  • entryFormat - String that 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 - Character(s) emitted in between the formatted items.
  • delim - Delimiter between fields (default is ";").

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>", "")]

Outputs:

Strength14
Constitution8
Dexterity13
Intelligence4
Wisdom18
Charisma9