basic

### Characters for Creating User-Defined Number Formats

The following shows the characters you can use to create user-defined number formats.

Character | Meaning
Null string | Display the number with no formatting.
0 | Digit placeholder. Display a digit or a zero. If the number being formatted has fewer digits than there are zeros (on either side of the decimal) in the format expression, leading or trailing zeros are displayed. If the number has more digits to the right of the decimal separator than there are zeros to the right of the decimal separator in the format expression, the number is rounded to as many decimal places as there are zeros.

If the number has more digits to left of the decimal separator than there are zeros to the left of the decimal separator in the format expression, the extra digits are displayed without modification.

# | Digit placeholder. Displays a digit or nothing. If there is a digit in the expression being formatted in the position where the # appears in the format string, displays it; otherwise, nothing is displayed.
. | Decimal placeholder.The decimal placeholder determines how many digits are displayed to the left and right of the decimal separator.

Character | Meaning | Description
% | Percentage placeholder. | The percent character (%) is inserted in the position where it appears in the format string. The expression is multiplied by 100.
, | Thousand separator. | The thousand separator separates thousands from hundreds within a number that has four or more places to the left of the decimal separator. Use of this separator as specified in the format statement contains a comma surrounded by digit placeholders(0 or #). Two adjacent commas or a comma immediately to the left of the decimal separator (whether or not a decimal is specified) means "scale the number by dividing it by 1000, rounding as needed."
E-E+e-e+ | Scientific format. | If the format expression contains at least one digit placeholder (0 or #) to the right of E-,E+,e- or e+, the number is displayed in scientific formatted E or e inserted between the number and its exponent. The number of digit placeholders to the right determines the number of digits in the exponent. Use E- or e- to place a minus sign next to negative exponents. Use E+ or e+ to place a plus sign next to positive exponents.
: | Time separator. | The actual character used as the time separator depends on the Time Format specified in the International section of the Control Panel.
/ | Date separator. | The actual character used as the date separator in the formatted out depends on Date Format specified in the International section of the Control Panel.

Character | Meaning
- + $ ( ) space | Display a literal character. To display a character other than one of those listed, precede it with a backslash (\).
\ | Display the next character in the format string. The backslash itself isn’t displayed. To display a backslash, use two backslashes (\\). Examples of characters that can’t be displayed as literal characters are the date- and time- formatting characters (a,c,d,h,m,n,p,q,s,t,w,y, and /:), the numeric -formatting characters(#,0,%,E,e,comma, and period), and the string- formatting characters (@,&,<,>, and !).
"String" | Display the string inside the double quotation marks. To include a string in fmt from within Enable, you must use the ANSI code for a double quotation mark Chr(34) to enclose the text.
* | Display the next character as the fill character. Any empty space in a field is filled with the character following the asterisk.

Unless the fmt argument contains one of the predefined formats, a format expression for numbers can have from one to four sections separated by semicolons.

If you use | The result is
One section only | The format expression applies to all values.
Two | The first section applies to positive values, the second to negative sections values.
Three | The first section applies to positive values, the second to negative sections values, and the third to zeros.
Four | The first section applies to positive values, the second to negative section values, the third to zeros, and the fourth to Null values.

The following example has two sections: the first defines the format for positive values and zeros; the second section defines the format for negative values.

1. "$#,##0; ($#,##0)"

If you include semicolons with nothing between them. the missing section is printed using the format of the positive value. For example, the following format displays positive and negative values using the format in the first section and displays "Zero" if the value is zero.

1. "$#,##0;;\Z\e\r\o"