Syntax: %format(f,a,b,c...)

Use a format string to format the values of a,b,c, etc. Format strings consist of a string of characters, with special format specifiers of the type &w.dx where w is the width of the field, d is the number of decimal places, and x is the format type.

Valid format types:

e: scientific notation(full format)
f: floting point (defaults to 2 decimal places)
g: scientific notation(abbreviated)
m: money (defaults to 2 decimal places)
n: number (commas every 3 digits, defaults to 2 decimal places)
s: string
d: integer (decimal). Same as n but without the commas

You can also use the syntax %format(n,x) to format a floating point number x with only n decimal points.

Special width modifier - switches from right justification to left.

Any error in the format parameters will cause format to return null.


<NOBR> #SHOW %format("&10.0n",123456)</NOBR>

will display 123,456 with 3 spaces padding the front
#SHOW %format("&3.0f &s",123,"coins")
will display '123 coins'
#SHOW %format(2,1.23456)
displays 1.23

Add comment

Login or register to post comments