strPropFromVars: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added information on varStyle being optional.)
Line 5: Line 5:


|usage=
|usage=
<source lang="mtmacro" line>
[h: strPropFromVars(varList) ]
</source>
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: strPropFromVars(varList, varStyle) ]
[h: strPropFromVars(varList, varStyle) ]
</source>
</source>
* varStyle is either "SUFFIXED" or "UNSUFFIXED". When fetching the values of the variables, the "SUFFIXED" option will look for variables with underscores appended to the given names. The output property string does not contain the underscores.
<source lang="mtmacro" line>
[h: strPropFromVars(varList, varStyle, delim) ]
</source>
'''Parameters'''
{{param|varList|A list of variable names, separated by ",".}}
{{param|varStyle|Either "SUFFIXED" or "UNSUFFIXED". The "SUFFIXED" option will look for variables with underscores appended to the given names. Defaults to "UNSUFFIXED".}}
{{param|delim|The delimiter for the return string. Defaults to ";". }}


|examples=
|examples=
Line 19: Line 28:
}}
}}
[[Category:String Property List Function]]
[[Category:String Property List Function]]
|changes=
{{change|1.5.4|Made {{code|varStyle}} optional.}}

Revision as of 20:35, 14 August 2019

strPropFromVars() Function

Creates a property string from the names and values of the variables listed in the varList string.

Usage

[h: strPropFromVars(varList) ]
[h: strPropFromVars(varList, varStyle) ]
[h: strPropFromVars(varList, varStyle, delim) ]

Parameters

  • varList - A list of variable names, separated by ",".
  • varStyle - Either "SUFFIXED" or "UNSUFFIXED". The "SUFFIXED" option will look for variables with underscores appended to the given names. Defaults to "UNSUFFIXED".
  • delim - The delimiter for the return string. Defaults to ";".

Examples

[H: props = "a=3 ; b=bob ; c=cow ; "]
[H: varsFromStrProp(props, "SUFFIXED")] <!-- creates variables a_, b_, c_ -->
[strPropFromVars("c,a,b", "SUFFIXED")]
(returns "c=cow ; a=3 ; b=bob ; "):

|changes=

  • 1.5.4 - Made varStyle optional.