To print strings or numbers using a specified format.
A pound sign is used to represent each digit position. Digit positions are always filled. If the number to be printed has fewer digits than positions specified, the number is right-justified (preceded by spaces) in the field.
A decimal point may be inserted at any position in the field. If the format string specifies that a digit is to precede the decimal point, the digit always is printed (as 0 if necessary). Numbers are rounded as necessary. For example:
PRINT USING "##.##";.78
PRINT USING "###.##";987.654
PRINT USING "##.##" ;10.2,5.3,66.789,.234
10.20 5.30 66.79 0.23
In the last example, three spaces were inserted at the end of the format string to separate the printed values on the line.
|+||A plus sign at the beginning or end of the format string causes the sign of the number (plus or minus) to be printed before or after the number.|
A minus sign at the end of the format field causes negative numbers to be printed with a trailing minus sign. For example:
-68.95 +2.40 +55.60 -0.90
68.95 22.45 7.01-
A double asterisk at the beginning of the format string causes leading spaces in the numeric field to be filled with asterisks. The ** also specifies two more digit positions. For example:
PRINT USING "**#.#";12.39,-0.9,765.1
A double dollar sign at the beginning of the format string causes a dollar sign to be printed to the immediate left of the formatted number. The $$ specifies two more digit positions, one of which is the dollar sign. The exponential format cannot be used with $$. Negative numbers cannot be used unless the minus sign trails to the right. For example:
PRINT USING "$$###.##";456.78
The **$ at the beginning of a format string combines the effects of the above two symbols. Leading spaces are filled with asterisks, and a dollar sign is printed before the number. **$ specifies three more digit positions, one of which is the dollar sign. For example:
PRINT USING "**$##.##";2.34
A comma to the left of the decimal point in the format string causes a comma to be printed to the left of every third digit to the left of the decimal point. A comma at the end of the format string is printed as part of the string.
PRINT USING "####.##";1234.5
Four carets may be placed after the digit position characters to specify exponential format. The four carets allow space for E+xx to be printed. Any decimal point position may be specified. The significant digits are left-justified, and the exponent is adjusted. Unless a leading + or trailing + or - is specified, one digit position is used to the left of the decimal point to print a space or a minus sign. For example:
PRINT USING "##.##^^^^";234.56
PRINT USING ".####^^^^-";888888
PRINT USING "+.##^^^^";123
Note that in the above examples the comma is not used as a delimiter with the exponential format.
An underscore in the format string causes the next character to be output as a literal character. For example:
PRINT USING "_!##.##_!";12.34
The literal character itself may be an underscore by placing "_" in the format string.
A percent sign is printed in front of the number if the number to be printed is larger than the specified numeric field. If rounding causes the number to exceed the field, a percent sign is printed in front of the rounded number. For example:
PRINT USING "##.##";111.22
PRINT USING ".##"';.999
If the number of digits specified exceeds 24, an "Illegal function call" error results.