localized formatting and parsing routines for Number
format
(value,options)
Defined by dojo/number
Format a Number as a String, using localespecific settings
Create a string from a Number using a known localized pattern. Formatting patterns appropriate to the locale are chosen from the Common Locale Data Repository as well as the appropriate symbols and delimiters. If value is Infinity, Infinity, or is not a valid JavaScript number, return null.
Parameter  Type  Description 

value  Number 
the number to be formatted 
options  Object  Optional
An object with the following properties:

Returns: null  undefined
parse
(expression,options)
Defined by dojo/number
Convert a properly formatted string to a primitive Number, using localespecific settings.
Create a Number from a string using a known localized pattern. Formatting patterns are chosen appropriate to the locale and follow the syntax described by unicode.org TR35 Note that literal characters in patterns are not supported.
Parameter  Type  Description 

expression  String 
A string representation of a Number 
options  Object  Optional
An object with the following properties:

Returns: number
regexp
(options)
Defined by dojo/number
Builds the regular needed to parse a number
Returns regular expression with positive and negative match, group and decimal separators
Parameter  Type  Description 

options  Object  Optional
An object with the following properties:

Returns: undefined
round
(value,places,increment)
Defined by dojo/number
Rounds to the nearest value with the given number of decimal places, away from zero
Rounds to the nearest value with the given number of decimal places, away from zero if equal. Similar to Number.toFixed(), but compensates for browser quirks. Rounding can be done by fractional increments also, such as the nearest quarter. NOTE: Subject to floating point errors. See dojox/math/round for experimental workaround.
Parameter  Type  Description 

value  Number 
The number to round 
places  Number  Optional
The number of decimal places where rounding takes place. Defaults to 0 for whole rounding. Must be nonnegative. 
increment  Number  Optional
Rounds next place to nearest value of increment/10. 10 by default. 
Returns: number
>>> number.round(0.5)
1
>>> number.round(162.295, 2)
162.29 // note floating point error. Should be 162.3
>>> number.round(10.71, 0, 2.5)
10.75
© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/_base/kernel.number.html