toFixed

Summary

Formats the double value using fixed-point notation.

Usage

public string toFixed(int digits)

Returns

The double value formatted using fixed-point notation.

Parameters

digits

The number of digits to appear in the final formatted value after the decimal point. This number can be between 0 and 20 (inclusive).

Description

Formats the double value using fixed-point notation.

The formatted value will be returned as a string.

The argument expects a number that specifies how many digits should appear after the decimal point in the formatted string.

System.Exceptions.OutOfRangeException will be thrown if the supplied argument is not an integer between 0 and 20 (inclusive).

Examples

Basic Usage
1
2
3
4
5
import System;
 
System.Double x = new System.Double(1);
Console.log(x.toFixed(5)); // "1.00000"
Console.log(x.toFixed(7)); // "1.0000000"

Share

HTML | BBCode | Direct Link