strPropFromVars: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added information on varStyle being optional.)
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 5: Line 5:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro">
[h: strPropFromVars(varList) ]
[h: strPropFromVars(varList) ]
</source>
<source lang="mtmacro" line>
[h: strPropFromVars(varList, varStyle) ]
[h: strPropFromVars(varList, varStyle) ]
</source>
<source lang="mtmacro" line>
[h: strPropFromVars(varList, varStyle, delim) ]
[h: strPropFromVars(varList, varStyle, delim) ]
</source>
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
{{param|varList|A list of variable names, separated by ",".}}
{{param|varList|A list of variable names, separated by ",".}}
Line 20: Line 16:


|examples=
|examples=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[H: props = "a=3 ; b=bob ; c=cow ; "]
[H: props = "a=3 ; b=bob ; c=cow ; "]
[H: varsFromStrProp(props, "SUFFIXED")] <!-- creates variables a_, b_, c_ -->
[H: varsFromStrProp(props, "SUFFIXED")] <!-- creates variables a_, b_, c_ -->
[strPropFromVars("c,a,b", "SUFFIXED")]
[strPropFromVars("c,a,b", "SUFFIXED")]
</source>
</syntaxhighlight>
(returns "c=cow ; a=3 ; b=bob ; "):
'''Returns'''
}}
<syntaxhighlight lang="mtmacro">
[[Category:String Property List Function]]
"c=cow ; a=3 ; b=bob"
</syntaxhighlight>


|also=
{{func|varsFromStrProp}}
|changes=
|changes=
{{change|1.5.4|Made {{code|varStyle}} optional.}}
{{change|1.5.4|Made {{code|varStyle}} optional.}}
}}
[[Category:String Property List Function]]

Latest revision as of 23:59, 14 March 2023

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"

See Also

Version Changes

  • 1.5.4 - Made varStyle optional.