ProvideX V8.20 > Language Reference > A. Appendix
811
Data Format Masks
A format mask is a character string that can be used to define how data is to be
displayed or printed in ProvideX (PRINT Directive, p.253). Masks can also be
applied to filter data being received from the keyboard (INPUT Directive, p.159) or
in the conversion/validation of a string (STR( ) Function, p.523).
For further information on data input and output in ProvideX, refer to the ProvideX
User's Guide.
Assigning a Format Mask
To assign a format mask in ProvideX syntax, place a colon before the mask following
the given data value:
val[$]:mask$
mask$ may be a literal string, a string variable, substring, or a string expression
(concatenation); e.g.,
0010 PRINT "The total is ",A:"$#,###,##0.00CR"
or
0010 LET MASK$="000-0000"
0020 PRINT "Phone: ",T:MASK$
The number of characters defined in a mask must be equal to or larger than the
number of characters to be displayed. One output character is generated for each
character present in the format mask.
When more characters exist in the data value than are specified in the format mask,
the result will generate an Error #43: Format mask invalid; e.g., outputting
1000 with a mask of "##0" causes an error. However, the parameters 'FI', 'F,' and
'FO'= can be specified to handle overflows without generating errors.
Format Defaults
If no format mask is specified when outputting numeric values, the system formats
the value as follows:
· The first character output will indicate the sign of the value. A space will be output
if positive, a minus sign if negative.
· If the absolute value is greater than 10E+18 or is less than 10E-18 (but not zero), the
value is output using scientific notation.
· The number is rounded to the current precision in effect and output suppressing
all leading zeroes and all trailing zeroes following the decimal point. The decimal
point is suppressed if no digits remain after it.
For example, assuming precision of two:
->0010 PRINT 3/2, 6/3, 3-4, 2/3
1.5 2-1 .67