Writes formatted data to a string in the same way that printf formats data into a C-style character array.

syntaxSyntax:
FWiz.Format(format, ...)

Parameters

Parameter Description
format Format string.
... Optional arguments.

Return Value

Returns a formatted string.

Remarks

The Format function formats a series of characters and values to the string. If arguments follow the format string, the format string must contain specifications that determine the output format for the arguments.

The format argument consists of ordinary characters, and (if arguments follow format) format specifications. The ordinary characters are copied to output in order of their appearance.

Format specifications always begin with a percent sign (%) and are read left to right. When printf encounters the first format specification (if any), it converts the value of the first argument after format and outputs it accordingly. The second format specification causes the second argument to be converted and output, and so on. If there are more arguments than there are format specifications, the extra arguments are ignored. The results are undefined if there are not enough arguments for all the format specifications.

For more information, see Format Specifications.

Example

  Copy codeCopy code
var str = FWiz.Format("Floating point: %.2f", 12345.12345);
FWiz.Printf("%s", str);

str = FWiz.Format("Left-justified integer: %.6d", 35);
FWiz.Printf("%s", str);

See also