@@ -5,17 +5,14 @@ https://www.boost.org/LICENSE_1_0.txt
55////
66
77[#format]
8- = Formatting support
8+ = Formatting Support
99:idprefix: format_
1010
1111Boost.Decimal supports formatting with both `<format>` (when C++20 and header are both available), and `<fmt/format.h>` with all language standards.
1212
13- [#std_format]
14- == `<format>`
15-
1613Format is supported when using C++20 and a compiler with appropriate support: GCC >= 13, Clang >= 18, MSVC >= 19.40
1714
18- === Locale Modifier
15+ == Locale Modifier
1916
2017If a format string begins with "L" the current global locale will be applied.
2118This can be set as so:
@@ -28,7 +25,7 @@ const std::locale a(locale);
2825std::locale::global(a);
2926----
3027
31- === Sign Modifier
28+ == Sign Modifier
3229
3330|===
3431| Modifier | Format
@@ -38,7 +35,7 @@ std::locale::global(a);
3835Negative have a minus sign
3936|===
4037
41- === Type Modifiers
38+ == Type Modifiers
4239
4340The following type modifiers are the same as those used by built-in floating point values:
4441
@@ -55,12 +52,12 @@ Example usage for scientific format would be: `{:e}`
5552
5653NOTE: The uppercase format will return with all applicable values in uppercase (e.g. 3.14E+02 vs 3.14e+02)
5754
58- === Precision Modifiers
55+ == Precision Modifiers
5956
6057Precision can be specified in the same way as built-in floating point values.
6158For example a scientific format with 3 digits or precision would be: `{:.3e}`
6259
63- === Padding Modifiers
60+ == Padding Modifiers
6461
6562If you want all values to be printed with a fixed width padding is allowed before the precision modifier.
6663For example with `{:10.3e}`:
@@ -70,7 +67,7 @@ For example with `{:10.3e}`:
7067
7168Note the space at the front of these string to keep with width at 10 characters
7269
73- === String Literal Support
70+ == String Literal Support
7471
7572If you want the result to be a different string width than `char` you can specify this with the format string.
7673For example if you want the result to be `wchar_t` you can use `L"{}"`.
@@ -79,13 +76,13 @@ For example if you want the result to be `wchar_t` you can use `L"{}"`.
7976
8077IMPORTANT: `std::format` only supports `char` and `wchar_t` types per the pass:[C++] specification.
8178
82- === Putting it All Together
79+ == Putting it All Together
8380
8481The appropriate order for the full format specifier is:
8582
8683String literal pass:["{Sign, Padding, Precision, Type, Locale}"]
8784
88- === Examples
85+ == Examples
8986
9087This example can be found in the examples/ folder as https://github.com/cppalliance/decimal/blob/develop/examples/fmt_format.cpp[fmt_format.cpp]
9188
0 commit comments