Translates the string representation of a {@code BigDecimal}
into a {@code BigDecimal}. The string representation consists
of an optional sign, {@code '+'} (<code> '\u002B'</code>) or
{@code '-'} (<code>'\u002D'</code>), followed by a sequence of
zero or more decimal digits ("the integer"), optionally
followed by a fraction, optionally followed by an exponent.
<p>The fraction consists of a decimal point followed by zero
or more decimal digits. The string must contain at least one
digit in either the integer or the fraction. The number formed
by the sign, the integer and the fraction is referred to as the
<i>significand</i>.
<p>The exponent consists of the character {@code 'e'}
(<code>'\u0065'</code>) or {@code 'E'} (<code>'\u0045'</code>)
followed by one or more decimal digits. The value of the
exponent must lie between -{@link Integer#MAX_VALUE} ({@link
Integer#MIN_VALUE}+1) and {@link Integer#MAX_VALUE}, inclusive.
<p>More formally, the strings this constructor accepts are
described by the following grammar:
<blockquote>
<dl>
<dt><i>BigDecimalString:</i>
<dd><i>Sign!(sub)opt</sub> Significand Exponent!(sub)opt</sub></i>
<dt><i>Sign:</i>
<dd>{@code +}
<dd>{@code -}
<dt><i>Significand:</i>
<dd><i>IntegerPart</i> {@code .} <i>FractionPart!(sub)opt</sub></i>
<dd>{@code .} <i>FractionPart</i>
<dd><i>IntegerPart</i>
<dt><i>IntegerPart:</i>
<dd><i>Digits</i>
<dt><i>FractionPart:</i>
<dd><i>Digits</i>
<dt><i>Exponent:</i>
<dd><i>ExponentIndicator SignedInteger</i>
<dt><i>ExponentIndicator:</i>
<dd>{@code e}
<dd>{@code E}
<dt><i>SignedInteger:</i>
<dd><i>Sign!(sub)opt</sub> Digits</i>
<dt><i>Digits:</i>
<dd><i>Digit</i>
<dd><i>Digits Digit</i>
<dt><i>Digit:</i>
<dd>any character for which {@link Character#isDigit}
returns {@code true}, including 0, 1, 2 ...
</dl>
</blockquote>
<p>The scale of the returned {@code BigDecimal} will be the
number of digits in the fraction, or zero if the string
contains no decimal point, subject to adjustment for any
exponent; if the string contains an exponent, the exponent is
subtracted from the scale. The value of the resulting scale
must lie between {@code Integer.MIN_VALUE} and
{@code Integer.MAX_VALUE}, inclusive.
<p>The character-to-digit mapping is provided by {@link
java.lang.Character#digit} set to convert to radix 10. The
string may not contain any extraneous characters (whitespace,
for example).
<p><b>Examples:</b><br>
The value of the returned {@code BigDecimal} is equal to
<i>significand</i> × 10!(sup) <i>exponent</i></sup>.
For each string on the left, the resulting representation
[{@code BigInteger}, {@code scale}] is shown on the right.
<pre>
"0" [0,0]
"0.00" [0,2]
"123" [123,0]
"-123" [-123,0]
"1.23E3" [123,-1]
"1.23E+3" [123,-1]
"12.3E+7" [123,-6]
"12.0" [120,1]
"12.3" [123,1]
"0.00123" [123,5]
"-1.23E-12" [-123,14]
"1234.5E-4" [12345,5]
"0E+7" [0,-7]
"-0" [0,0]
</pre>
@apiNote For values other than {@code float} and
{@code double} NaN and ±Infinity, this constructor is
compatible with the values returned by {@link Float#toString}
and {@link Double#toString}. This is generally the preferred
way to convert a {@code float} or {@code double} into a
BigDecimal, as it doesn't suffer from the unpredictability of
the {@link #BigDecimal(double)} constructor.
@param val string representation of {@code BigDecimal}.
@throws NumberFormatException if {@code val} is not a valid
representation of a {@code BigDecimal}.
Translates the string representation of a {@code BigDecimal} into a {@code BigDecimal}. The string representation consists of an optional sign, {@code '+'} (<code> '\u002B'</code>) or {@code '-'} (<code>'\u002D'</code>), followed by a sequence of zero or more decimal digits ("the integer"), optionally followed by a fraction, optionally followed by an exponent.
<p>The fraction consists of a decimal point followed by zero or more decimal digits. The string must contain at least one digit in either the integer or the fraction. The number formed by the sign, the integer and the fraction is referred to as the <i>significand</i>.
<p>The exponent consists of the character {@code 'e'} (<code>'\u0065'</code>) or {@code 'E'} (<code>'\u0045'</code>) followed by one or more decimal digits. The value of the exponent must lie between -{@link Integer#MAX_VALUE} ({@link Integer#MIN_VALUE}+1) and {@link Integer#MAX_VALUE}, inclusive.
<p>More formally, the strings this constructor accepts are described by the following grammar: <blockquote> <dl> <dt><i>BigDecimalString:</i> <dd><i>Sign!(sub)opt</sub> Significand Exponent!(sub)opt</sub></i> <dt><i>Sign:</i> <dd>{@code +} <dd>{@code -} <dt><i>Significand:</i> <dd><i>IntegerPart</i> {@code .} <i>FractionPart!(sub)opt</sub></i> <dd>{@code .} <i>FractionPart</i> <dd><i>IntegerPart</i> <dt><i>IntegerPart:</i> <dd><i>Digits</i> <dt><i>FractionPart:</i> <dd><i>Digits</i> <dt><i>Exponent:</i> <dd><i>ExponentIndicator SignedInteger</i> <dt><i>ExponentIndicator:</i> <dd>{@code e} <dd>{@code E} <dt><i>SignedInteger:</i> <dd><i>Sign!(sub)opt</sub> Digits</i> <dt><i>Digits:</i> <dd><i>Digit</i> <dd><i>Digits Digit</i> <dt><i>Digit:</i> <dd>any character for which {@link Character#isDigit} returns {@code true}, including 0, 1, 2 ... </dl> </blockquote>
<p>The scale of the returned {@code BigDecimal} will be the number of digits in the fraction, or zero if the string contains no decimal point, subject to adjustment for any exponent; if the string contains an exponent, the exponent is subtracted from the scale. The value of the resulting scale must lie between {@code Integer.MIN_VALUE} and {@code Integer.MAX_VALUE}, inclusive.
<p>The character-to-digit mapping is provided by {@link java.lang.Character#digit} set to convert to radix 10. The string may not contain any extraneous characters (whitespace, for example).
<p><b>Examples:</b><br> The value of the returned {@code BigDecimal} is equal to <i>significand</i> × 10!(sup) <i>exponent</i></sup>. For each string on the left, the resulting representation [{@code BigInteger}, {@code scale}] is shown on the right. <pre> "0" [0,0] "0.00" [0,2] "123" [123,0] "-123" [-123,0] "1.23E3" [123,-1] "1.23E+3" [123,-1] "12.3E+7" [123,-6] "12.0" [120,1] "12.3" [123,1] "0.00123" [123,5] "-1.23E-12" [-123,14] "1234.5E-4" [12345,5] "0E+7" [0,-7] "-0" [0,0] </pre>
@apiNote For values other than {@code float} and {@code double} NaN and ±Infinity, this constructor is compatible with the values returned by {@link Float#toString} and {@link Double#toString}. This is generally the preferred way to convert a {@code float} or {@code double} into a BigDecimal, as it doesn't suffer from the unpredictability of the {@link #BigDecimal(double)} constructor.
@param val string representation of {@code BigDecimal}.
@throws NumberFormatException if {@code val} is not a valid representation of a {@code BigDecimal}.