Return formatted output as new string, this function does emulate the C/C++ stdio function vsprintf(), it takes the arguments required for formatting, but returns the result in a string rather than printing it. You may use this function, if you need the resulting string prior to printing, eg. to calculate the position for justified output, or if you want to concatenate many strings using (semi)colons in one PRINT.
SYNTAX:
formatted$ = VSPrintF$ (fmt$, vargs$)
INPUTS:
fmt$ (STRING)
- Any string literal or variable, which can contain any escape sequences known to C/C++ and formatting tokens known to the standard library function printf().
vargs$ (STRING variable)
- A variable args string made with the SUBs/FUNCTIONs in qbstdarg.bm, which must contain all required arguments in the very same order as the respective formatting tokens appear in the given format string.
RESULT:
formatted$ (STRING)
- The new formatted string, ie. all formatting tokens in the given format string (fmt$) have been replaced with the respective argument from the variable args string (vargs$) and all escape sequences have been evaluated and replaced by the respective characters.
ERRORS:
- If fmt$ is empty or vargs$ is no valid va_list string, then this function will return an empty string.