USING(templateString, numericExpression)
Description:
This function formats numericExpression as a string using templateString. The rules for the format are similar to those in Microsoft BASIC's PRINT USING statement, but since using( ) is a function, it can be used as part of a larger BASIC expression instead of being useful only for display output directly. The template string consists of the character "#" to indicate placement for numerals, and a single dot "." to indicate placement for the decimal point. The template string must be contained within double quotation marks. If there are more digits contained in a number than allowed for by the template string, the results will be rounded.
A template string looks like this:
amount$ = using("######.##", 1234.56)
As part of a larger expression:
notice "Your total is $" + using("####.##", 1234.5)
A template string can be expressed as a string variable:
template$ = "######.##"
amount$ = using(template$, 1234.56)
Using() may be used in conjunction with 'print'. The following two examples produce the same result:
amount$ = using("######.##", 123456.78)
print amount$
print using("######.##", 123456.78)
Usage:
'print a column of ten justified numbers
for a = 1 to 10
print using("####.##", rnd(1)*1000)
next a
Sample output from the routine above:
72.06
244.28
133.74
99.64
813.50
529.65
601.19
697.91
5.82
619.22