The function format accepts variable number of arguments. The first argument is a format string and the rest of the arguments are used to create the result string according to the format string. This way the function format is like the C function sprintf.
The format string can contain normal characters and control substrings.
The control substring have the form %[flags][width][.precision]type. It follows the general sprintf format except that type prefixes are not required or allowed and type can only be "dioxXueEfgGsc". The * for width and precision is supported.
An alternate format BASIC-like for numbers has the form %~format~ where format can be:
# Digit or space
0 Digit or zero
^ Stores a number in exponential format. Unlike QB's USING format this is a place-holder like the #.
. The position of the decimal point.
, Separator.
- Stores minus if the number is negative.
+ Stores the sign of the number.
Acknowledgement: the function format was implemented by Paulo Soares <psoares@consiste.pt>