Script functions reference > Script functions in alphabetical order > N > NFormat

NFormat
Syntax
NFormat(syntax, num);
syntax
Z – A digit displayed if required. If the value of a leading or trailing digit is zero, the digit is replaced by a space, " ".
B – A digit displayed if required. If the value of a leading or trailing digit is zero, the digit is removed.
9 – A digit that is always displayed.
# – A digit on either side of a decimal separator, or the last sign if no decimal separator exists. The digit is always displayed.
Note:
Z and B cannot coexist on the same side of the decimal separator. For example, ZB#.#BZ is not a valid format.
Note:
"#.##" formats the value 0 as an empty string.
num
Description
Converts a number to a string, formatting the string according to the specified format syntax.
Note:
Returns
A string according to the specified format syntax.
Example
$a=1234.5;
$b=nformat("Z,ZZ#.##",$a);
$c=nformat("9999#.##",$a);
$d=nformat("ZZ.ZZ",0);
$e=nformat("ZZ.ZZ",0.07);
Result:
$b="1,234.50"
$c="01234.50"
$d=""
$e=".07"
OpenText StreamServe 5.6 Updated: 2013-03-01