The vsprintf()
function writes the formatted string into a variable.
Unlike sprintf()
, the parameters in vsprintf()
are in the array. The array element will be inserted at the percent sign (%) symbol in the main string. This function is executed step by step. At the first % symbol, insert the first array element, at the second % symbol, insert the second array element, and so on.
Note: If the % symbol is more than the arg parameter, you must use placeholders. The placeholder is inserted into the % symbol and consists of a number and "\$". See Example 2.
Tip: Related functions:
fprintf()
printf()
sprintf()
vfprintf()
vprintf()
vsprintf ( format , argarray )
parameter | describe |
---|---|
format |
Required. Specifies the string and how to format the variables in it. Possible format values:
Additional format value. Necessarily placed between % and letters (for example %.2f):
Note: If you use multiple format values above, they must be used in the order above and cannot be disrupted. |
argarray | Required. An array with parameters that are inserted into the % symbol in the format string. |