Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

2.1.32 [ECMA-262/5] Section 15.7.4.3, Number.prototype.toLocaleString ()

C0001:

The specification states:

Produces a string value that represents the value of this Number value formatted according to the conventions of the host environment’s current locale. This function is implementation-dependent, and it is permissible, but not encouraged, for it to return the same thing as toString.

IE9 Mode, IE10 Mode, and IE11 Mode (All Versions)

Internet Explorer ECMAScript determines a string value as follows.

  1. If the value of the Number object is an integer, return the result of calling the Function.prototype.toString method with the Number value as the argument.

  2. If this Number value is NaN, return the string value "NaN".

  3. If this Number value is +Infinity or -Infinity, return the statically localized string that describes such a value.

  4. Create a string value by using the Number.prototype.toFixed algorithm in section 15.7.4.5 of [ECMA-262/5]. Use this Number value as the this value. Use the actual number of significant decimal fraction digits, fractionDigits, of this Number value as the argument. The fractionDigits value is computed according to the ToString algorithm in section 9.8.1 of [ECMA-262/5].

  5. Call the GetNumberFormat Microsoft Windows system function (http://msdn.microsoft.com/en-us/library/dd318110(VS.85).aspx), passing it Result(4) and the current locale information. The values zero and NULL are passed as the format flags and the lpFormat arguments.

  6. If the call in step 5 succeeds, return Result(5).

  7. If the calls in either step 4 or step 5 fail, return the result of calling the standard built-in Date.prototype.toString method with Result(1) as the this object.

  8. Call the VariantChangeType Windows OLE Automation function (http://msdn.microsoft.com/en-us/library/aa910747.aspx), passing it Result(4) and the current locale information.

  9. Return the string value that corresponds to Result(8).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.