...
- 's' - string
- 'd' - integer
- 'e' - floating point number; the output is formatted as a decimal number in computerized scientific notation
- 'f' - floating point number
- 'g' - floating point number; the output is formatted using computerized scientific notation or decimal format, depending on the precision and the value after rounding
- 't' - date/time
- '%' - percent; gives a literal '%' sign in the output
Additional Examples:
- format("%.2f",_out.example), where _out.example = 12345678.468
The above example will output "12345678.47" as a string. This is useful as toString(12345678.468) will output 1.2345678468E7, i.e. scientific form. the "f" character in the function input: format("%.2f",_out.example) converts the number to string in non-scientific notation.
- do(
$dps = 2,
$variable = "%." + toString($dps) + "f",
format($variable,_out.example )
)
The above example demonstrates putting a dollar variable into the first input to the format function. This allows the output to be more flexible, i.e. in this example the $dps can hold the number of decimal places.