Difference between revisions of "Sv Construct"
Jump to navigation
Jump to search
no edit summary
imported>Odessa m (clarified example) |
imported>Odessa |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
|origin = NVSE | |origin = NVSE | ||
|summary = Returns a string variable constructed from the specified string and up to 20 [[String Formatting|formatting]] arguments. If no formatting is required, this function is not necessary, as the [[Let]] command can be used to assign string variables. | |summary = Returns a string variable constructed from the specified string and up to 20 [[String Formatting|formatting]] arguments. | ||
If no formatting is required, this function is not necessary, as the [[Let]] command can be used to assign string variables. Note that <b>Let</b> supports concatanation and the [[ToString|ToString($)]] function which can usually achieve the same result as formatting. | |||
|name = Sv_Construct | |name = Sv_Construct | ||
Line 14: | Line 16: | ||
==Example== | ==Example== | ||
<pre> | <pre> | ||
string_var my_string | string_var my_string | ||
int iValue | int iValue | ||
ref rActor | ref rActor | ||
; Used to construct a formatted string: | |||
let my_string := Sv_Construct "iValue equals %g and rActor's name is %n", iValue, rActor | let my_string := Sv_Construct "iValue equals %g and rActor's name is %n", iValue, rActor | ||
</pre> | |||
Typically you can skip Sv_Construct and use concatanation with [[ToString|ToString($)]] instead of formatting, if you prefer: | |||
<pre> | |||
let my_string := "iValue equals " + $iValue + " and rActor's name is " + $rActor | |||
</pre> | </pre> | ||
==See Also== | ==See Also== |