NXSL:format

From NetXMS Wiki
Revision as of 02:18, 6 January 2013 by Victor (talk | contribs) (Created page with "__NOTOC__ Formats a numeric value. == Syntax == format(''number'', ''width'', ''precision''); == Parameters == :{| |- | ''number'' || The numeric value to format. |- | '...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Formats a numeric value.


Syntax

format(number, width, precision);


Parameters

number The numeric value to format.
width Minimum number of characters. If the number of characters in the output value is less than the specified width, blanks are added to the left or the right of the values — depending on whether the width is negative (for left alignment) or positive (for right alignment) — until the minimum width is reached. The width specification never causes a value to be truncated.
precision The number of decimal places. Floating point value will be rounded accordingly.


Return Value

Formatted numeric value.


Examples

format(3.7, 7, 2)		->	"   3.70"
format(3.7, -7, 2)		->	"3.70   "
format(5.7278, 1, 2)		->	"5.73"
format(5.7278, 1, 0)		->	"6"