Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojo/number.js

  • Provides:

    • dojo.number
  • Requires:

    • dojo.i18n in common
    • dojo.string in common
    • dojo.regexp in common
  • dojo.number

    • summary
      localized formatting and parsing routines for Number
    • type
      Object
  • dojo.number.__FormatOptions

    • type
      Function
  • dojo.number.__FormatOptions.pattern

    • optional
    • type
      String
    • summary
      override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
      with this string.  Default value is based on locale.  Overriding this property will defeat
      localization.  Literal characters in patterns are not supported.
  • dojo.number.__FormatOptions.type

    • optional
    • type
      String
    • summary
      choose a format type based on the locale from the following:
      decimal, scientific (not yet supported), percent, currency. decimal by default.
  • dojo.number.__FormatOptions.places

    • optional
    • type
      Number
    • summary
      fixed number of decimal places to show.  This overrides any
      information in the provided pattern.
  • dojo.number.__FormatOptions.round

    • optional
    • type
      Number
    • summary
      5 rounds to nearest .5; 0 rounds to nearest whole (default). -1
      means do not round.
  • dojo.number.__FormatOptions.locale

    • optional
    • type
      String
    • summary
      override the locale used to determine formatting rules
  • dojo.number.__FormatOptions.fractional

    • optional
    • type
      Boolean
    • summary
      If false, show no decimal places, overriding places and pattern settings.
  • dojo.number.format

    • parameters:
      • value: (typeof Number)
        the number to be formatted
      • options: (typeof dojo.number.__FormatOptions)
    • returns
      null|String
    • summary
      Format a Number as a String, using locale-specific settings
    • description
      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](http://unicode.org/cldr) as well as the appropriate symbols and
      delimiters.
      If value is Infinity, -Infinity, or is not a valid JavaScript number, return null.
    • type
      Function
  • dojo.number._numberPatternRE

    • alias - dojo.number._numberPatternRE
    • type
      RegExp
  • dojo.number._applyPattern

    • parameters:
      • value: (typeof Number)
        the number to be formatted.
      • pattern: (typeof String)
        a pattern string as described by
        [unicode.org TR35](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
      • options: (typeof dojo.number.__FormatOptions)
        _applyPattern is usually called via <code>dojo.number.format()</code> which
        populates an extra property in the options parameter, &quot;customs&quot;.
        The customs object specifies group and decimal parameters if set.
    • summary
      Apply pattern to format value as a string using options. Gives no
      consideration to local customs.
    • type
      Function
  • dojo.number.round

    • parameters:
      • value: (typeof Number)
        The number to round
      • places: (typeof Number)
        The number of decimal places where rounding takes place.  Defaults to 0 for whole rounding.
        Must be non-negative.
      • increment: (typeof Number)
        Rounds next place to nearest value of increment/10.  10 by default.
      • v
      • p
      • m
    • returns
      Number
    • summary
      Rounds to the nearest value with the given number of decimal places, away from zero
    • description
      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.
    • example
      >>> dojo.number.round(-0.5)
      -1
      >>> dojo.number.round(162.295, 2)
      162.29  // note floating point error.  Should be 162.3
      >>> dojo.number.round(10.71, 0, 2.5)
      10.75
    • alias - dojo.number.round
    • type
      Function
  • dojo.number.__FormatAbsoluteOptions

    • type
      Function
  • dojo.number.__FormatAbsoluteOptions.decimal

    • optional
    • type
      String
    • summary
      the decimal separator
  • dojo.number.__FormatAbsoluteOptions.group

    • optional
    • type
      String
    • summary
      the group separator
  • dojo.number.__FormatAbsoluteOptions.places

    • optional
    • type
      Number|String
    • summary
      number of decimal places.  the range &quot;n,m&quot; will format to m places.
  • dojo.number.__FormatAbsoluteOptions.round

    • optional
    • type
      Number
    • summary
      5 rounds to nearest .5; 0 rounds to nearest whole (default). -1
      means don't round.
  • dojo.number._formatAbsolute

    • parameters:
      • value: (typeof Number)
        the number to be formatted, ignores sign
      • pattern: (typeof String)
        the number portion of a pattern (e.g. <code>#,##0.00</code>)
      • options: (typeof dojo.number.__FormatAbsoluteOptions)
    • summary
      Apply numeric pattern to absolute value using options. Gives no
      consideration to local customs.
    • type
      Function
  • dojo.number.__RegexpOptions

    • type
      Function
  • dojo.number.__RegexpOptions.pattern

    • optional
    • type
      String
    • summary
      override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
      with this string.  Default value is based on locale.  Overriding this property will defeat
      localization.
  • dojo.number.__RegexpOptions.type

    • optional
    • type
      String
    • summary
      choose a format type based on the locale from the following:
      decimal, scientific (not yet supported), percent, currency. decimal by default.
  • dojo.number.__RegexpOptions.locale

    • optional
    • type
      String
    • summary
      override the locale used to determine formatting rules
  • dojo.number.__RegexpOptions.strict

    • optional
    • type
      Boolean
    • summary
      strict parsing, false by default.  Strict parsing requires input as produced by the format() method.
      Non-strict is more permissive, e.g. flexible on white space, omitting thousands separators
  • dojo.number.__RegexpOptions.places

    • optional
    • type
      Number|String
    • summary
      number of decimal places to accept: Infinity, a positive number, or
      a range &quot;n,m&quot;.  Defined by pattern or Infinity if pattern not provided.
  • dojo.number.regexp

    • parameters:
      • options: (typeof dojo.number.__RegexpOptions)
    • returns
      String
    • summary
      Builds the regular needed to parse a number
    • description
      Returns regular expression with positive and negative match, group
      and decimal separators
    • type
      Function
  • dojo.number._parseInfo

    • parameters:
      • options: (typeof Object)
    • returns
      Object
    • type
      Function
  • dojo.number.__ParseOptions

    • type
      Function
  • dojo.number.__ParseOptions.pattern

    • optional
    • type
      String
    • summary
      override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
      with this string.  Default value is based on locale.  Overriding this property will defeat
      localization.  Literal characters in patterns are not supported.
  • dojo.number.__ParseOptions.type

    • optional
    • type
      String
    • summary
      choose a format type based on the locale from the following:
      decimal, scientific (not yet supported), percent, currency. decimal by default.
  • dojo.number.__ParseOptions.locale

    • optional
    • type
      String
    • summary
      override the locale used to determine formatting rules
  • dojo.number.__ParseOptions.strict

    • optional
    • type
      Boolean
    • summary
      strict parsing, false by default.  Strict parsing requires input as produced by the format() method.
      Non-strict is more permissive, e.g. flexible on white space, omitting thousands separators
  • dojo.number.__ParseOptions.fractional

    • optional
    • type
      Boolean|Array
    • summary
      Whether to include the fractional portion, where the number of decimal places are implied by pattern
      or explicit 'places' parameter.  The value [true,false] makes the fractional portion optional.
  • dojo.number.parse

    • parameters:
      • expression: (typeof String)
        A string representation of a Number
      • options: (typeof dojo.number.__ParseOptions)
    • returns
      NaN|Number
    • summary
      Convert a properly formatted string to a primitive Number, using
      locale-specific settings.
    • description
      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](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
      Note that literal characters in patterns are not supported.
    • type
      Function
  • dojo.number.__RealNumberRegexpFlags

    • type
      Function
  • dojo.number.__RealNumberRegexpFlags.places

    • optional
    • type
      Number
    • summary
      The integer number of decimal places or a range given as &quot;n,m&quot;.  If
      not given, the decimal part is optional and the number of places is
      unlimited.
  • dojo.number.__RealNumberRegexpFlags.decimal

    • optional
    • type
      String
    • summary
      A string for the character used as the decimal point.  Default
      is &quot;.&quot;.
  • dojo.number.__RealNumberRegexpFlags.fractional

    • optional
    • type
      Boolean|Array
    • summary
      Whether decimal places are used.  Can be true, false, or [true,
      false].  Default is [true, false] which means optional.
  • dojo.number.__RealNumberRegexpFlags.exponent

    • optional
    • type
      Boolean|Array
    • summary
      Express in exponential notation.  Can be true, false, or [true,
      false]. Default is [true, false], (i.e. will match if the
      exponential part is present are not).
  • dojo.number.__RealNumberRegexpFlags.eSigned

    • optional
    • type
      Boolean|Array
    • summary
      The leading plus-or-minus sign on the exponent.  Can be true,
      false, or [true, false].  Default is [true, false], (i.e. will
      match if it is signed or unsigned).  flags in regexp.integer can be
      applied.
  • dojo.number._realNumberRegexp

    • parameters:
      • flags: (typeof dojo.number.__RealNumberRegexpFlags)
    • returns
      String
    • summary
      Builds a regular expression to match a real number in exponential
      notation
    • type
      Function
  • dojo.number.__IntegerRegexpFlags

    • type
      Function
  • dojo.number.__IntegerRegexpFlags.signed

    • optional
    • type
      Boolean
    • summary
      The leading plus-or-minus sign. Can be true, false, or <code>[true,false]</code>.
      Default is <code>[true, false]</code>, (i.e. will match if it is signed
      or unsigned).
  • dojo.number.__IntegerRegexpFlags.separator

    • optional
    • type
      String
    • summary
      The character used as the thousands separator. Default is no
      separator. For more than one symbol use an array, e.g. <code>[&quot;,&quot;, &quot;&quot;]</code>,
      makes ',' optional.
  • dojo.number.__IntegerRegexpFlags.groupSize

    • optional
    • type
      Number
    • summary
      group size between separators
  • dojo.number.__IntegerRegexpFlags.groupSize2

    • optional
    • type
      Number
    • summary
      second grouping, where separators 2..n have a different interval than the first separator (for India)
  • dojo.number._integerRegexp

    • parameters:
      • flags: (typeof dojo.number.__IntegerRegexpFlags)
    • returns
      String
    • summary
      Builds a regular expression that matches an integer
    • type
      Function
  • dojo

    • type
      Object