Decimal.this

Converts a string representing a number to an exact decimal.

If the string does not represent a number, then the result is NaN and invalidOperation is true.

  1. this(T num)
  2. this(S str)
    struct Decimal(Hook = Abort)
    this
    (
    S
    )
    (
    S str
    )
    if (
    isForwardRange!S &&
    isSomeChar!(ElementEncodingType!S)
    &&
    !isInfinite!S
    &&
    !isSomeString!S
    )
  3. this(S str)

Parameters

str S

The string to convert from

Specification:

sign           ::=  + | -
digit          ::=  0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
indicator      ::=  e | E
digits         ::=  digit [digit]...
decimal-part   ::=  digits . [digits] | [.] digits
exponent-part  ::=  indicator [sign] digits
infinity       ::=  Infinity | Inf
nan            ::=  NaN
numeric-value  ::=  decimal-part [exponent-part] | infinity
numeric-string ::=  [sign] numeric-value | [sign] nan

Exceptional Conditions

invalidOperation is flagged when str is not a valid string

Meta