## Format Function

Format (expression [,fmt ] )

Formats a string, number or variant datatype to a format expression.

Format returns returns a string

Part | Description
Expression | Expression to be formatted.
Fmt | A string of characters that specify how the expression is to displayed. or the name of a commonly-used format that has been predefined in Enable Basic. Do not mix different type format expressions in a single fmt parameter.

If the fmt parameter is omitted or is zero-length and the expression parameter is a numeric, Format[$] provides the same functionality as the Str[$] function by converting the numeric value to the appropriate return data type, Positive numbers convert to strings using Format[$] lack the leading space reserved for displaying the sign of the value, whereas those converted using Str[$] retain the leading space.

To format numbers, you can use the commonly-used formats that have been predefined in Enable Basic or you can create user-defined formats with standard characters that have special meaning when used in a format expression.

More:

Predefined numeric format names:

Characters for Creating User-Defined Number Formats

Sample Format Number Expressions