Top  Previous  Next


The FMT() function performs data formatting according to a format template. It is typically used to convert data for display or printing. The FMTS() function is identical to FMT() except that it works on each element of a dynamic array in turn, returning the result in a similarly delimited dynamic array.





FMT(expr, fmt.spec)

FMTS(expr, fmt.spec)




exprevaluates to the data to be formatted


fmt.specevaluates to the format specification.



The FMT() function sets the STATUS() function value to indicate whether the operation was successful. Possible values are


0Successful formatting.
1Data to format was too long or invalid for the format specification.
2The format specification was invalid.


Operations  that result in a non-zero STATUS() value return expr as the function result.



Shortform Notation


For compatibility with other systems, the FMT() function action can also be performed in QMBasic programs (but not in I-type dictionary entries) by use of a shortform notation in which the expr and fmt.spec are simply written next to each other with no operator in between.



X = FMT(A, '8R')

can be written as

X = A '8R'