tmp/tmpacj9ybh6/{from.md → to.md}
RENAMED
|
@@ -19,13 +19,17 @@ does not change `err`; otherwise, sets `err` to `(err|str.failbit)`, or
|
|
| 19 |
does not change `units` or `digits`. Uses the pattern returned by
|
| 20 |
`mp.neg_format()` to parse all values. The result is returned as an
|
| 21 |
integral value stored in `units` or as a sequence of digits possibly
|
| 22 |
preceded by a minus sign (as produced by `ct.widen(c)` where `c` is
|
| 23 |
`’-’` or in the range from `’0’` through `’9’`, inclusive) stored in
|
| 24 |
-
`digits`.
|
| 25 |
-
|
| 26 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
any such characters are not read, and parsing is terminated at the point
|
| 28 |
where they first appear. Otherwise, thousands separators are optional;
|
| 29 |
if present, they are checked for correct placement only after all format
|
| 30 |
components have been read.
|
| 31 |
|
|
@@ -41,27 +45,30 @@ format; otherwise, the currency symbol is required.
|
|
| 41 |
|
| 42 |
If the first character (if any) in the string `pos` returned by
|
| 43 |
`mp.positive_sign()` or the string `neg` returned by
|
| 44 |
`mp.negative_sign()` is recognized in the position indicated by `sign`
|
| 45 |
in the format pattern, it is consumed and any remaining characters in
|
| 46 |
-
the string are required after all the other format components.
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
Digits in the numeric monetary component are extracted and placed in
|
| 59 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 60 |
value for `units`, in the order in which they appear, preceded by a
|
| 61 |
minus sign if and only if the result is negative. The value `units` is
|
| 62 |
-
produced as if by[^
|
| 63 |
|
| 64 |
``` cpp
|
| 65 |
for (int i = 0; i < n; ++i)
|
| 66 |
buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
|
| 67 |
buf2[n] = 0;
|
|
|
|
| 19 |
does not change `units` or `digits`. Uses the pattern returned by
|
| 20 |
`mp.neg_format()` to parse all values. The result is returned as an
|
| 21 |
integral value stored in `units` or as a sequence of digits possibly
|
| 22 |
preceded by a minus sign (as produced by `ct.widen(c)` where `c` is
|
| 23 |
`’-’` or in the range from `’0’` through `’9’`, inclusive) stored in
|
| 24 |
+
`digits`.
|
| 25 |
+
|
| 26 |
+
[*Example 1*: The sequence `$1,056.23` in a common United States locale
|
| 27 |
+
would yield, for `units`, `105623`, or, for `digits`,
|
| 28 |
+
`"105623"`. — *end example*]
|
| 29 |
+
|
| 30 |
+
If `mp.grouping()` indicates that no thousands separators are permitted,
|
| 31 |
any such characters are not read, and parsing is terminated at the point
|
| 32 |
where they first appear. Otherwise, thousands separators are optional;
|
| 33 |
if present, they are checked for correct placement only after all format
|
| 34 |
components have been read.
|
| 35 |
|
|
|
|
| 45 |
|
| 46 |
If the first character (if any) in the string `pos` returned by
|
| 47 |
`mp.positive_sign()` or the string `neg` returned by
|
| 48 |
`mp.negative_sign()` is recognized in the position indicated by `sign`
|
| 49 |
in the format pattern, it is consumed and any remaining characters in
|
| 50 |
+
the string are required after all the other format components.
|
| 51 |
+
|
| 52 |
+
[*Example 2*: If `showbase` is off, then for a `neg` value of `"()"`
|
| 53 |
+
and a currency symbol of `"L"`, in `"(100 L)"` the `"L"` is consumed;
|
| 54 |
+
but if `neg` is `"-"`, the `"L"` in `"-100 L"` is not
|
| 55 |
+
consumed. — *end example*]
|
| 56 |
+
|
| 57 |
+
If `pos` or `neg` is empty, the sign component is optional, and if no
|
| 58 |
+
sign is detected, the result is given the sign that corresponds to the
|
| 59 |
+
source of the empty string. Otherwise, the character in the indicated
|
| 60 |
+
position must match the first character of `pos` or `neg`, and the
|
| 61 |
+
result is given the corresponding sign. If the first character of `pos`
|
| 62 |
+
is equal to the first character of `neg`, or if both strings are empty,
|
| 63 |
+
the result is given a positive sign.
|
| 64 |
|
| 65 |
Digits in the numeric monetary component are extracted and placed in
|
| 66 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 67 |
value for `units`, in the order in which they appear, preceded by a
|
| 68 |
minus sign if and only if the result is negative. The value `units` is
|
| 69 |
+
produced as if by[^20]
|
| 70 |
|
| 71 |
``` cpp
|
| 72 |
for (int i = 0; i < n; ++i)
|
| 73 |
buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
|
| 74 |
buf2[n] = 0;
|