XML DOM » XTLRuntime » formatNumber

Compability: Internet Explorer

xtlRuntime.formatNumber(dblNumber, bstrFormat)

This method formats the supplied number using the specified format.

The formatNumber method returns the supplied number as a string formatted using the specified format. Zero or more of the following formatting characteristics may be applied:

  • #
    displays only significant digits; does not display insignificant zeroes.
  • 0 (zero)
    displays insignificant zeroes, if the number has fewer digits than there are zeroes in the format.
  • ?
    adds spaces for insignificant zeroes on either side of the decimal point, so that decimal points align with a fixed-point font. This symbol can also be used for fractions with varying numbers of digits.
  • .
    indicates the placement of the decimal point within the format.
  • ,
    displays a comma as a thousands separator, or scales a number by a multiple of one thousand.
  • %
    displays number as a percentage.
  • E-
    (also 'e-'). Displays the number in scientific format (exponential notation). If a format contains a zero or number sign (#) to the right of an exponent code, it displays the number is scientific format, and inserts an 'E' or 'e'. The number of zeroes or number signs to the right determines the number of digits in the exponent. Place a minus sign by negative exponents.
  • E+
    (also 'e+'). Places a minus sign by negative exponents, and a plus sign by positive exponents.