Using yformat or vyformat it is possible to insert optional arguments into a string. This is used by the Error Manager to permit inserting optional arguments into error message strings.
Unlike sprintf(), yformat() and vyformat() uses a completely different formatting mechanism for inserting optional arguments into a string. Currently yformat() and vyformat() can take up to 9 optional parameters.
The format of the yformat and vyformat format specifiers is:
# ([1-9]) [SPLXI]
The character following the # sign can be an optional digit from 1 to 9, followed by a single character specifying the format of the string to insert. The digit [1-9] indicates which optional parameter in the argument list to insert at this location, and the second character specifies the format of the argument to insert:
S C format string P Pascal format string L Long Integer (displayed as decimal) X Long Integer (displayed as hexidecimal) I Long Integer (displayed as four characters)
With yformat() it is possible to insert the different arguments in any order. The only caviat is that if you do use the different format specifiers to reorder the insertion of arguments, format specifiers must exist for all the other arguments. That is, if you insert argument 3 of the parameter list, you must also specify arguments 1 and 2.
For example, the following:
yformat(dest, "Message #3S at #1L #2S", 20L, "Fred", "Thing")
Will put the string "Message Thing at 20 Fred" into the string 'dest'.