diff options
| author | Dan Engelbrecht <[email protected]> | 2026-03-23 20:39:32 +0100 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2026-03-23 20:39:32 +0100 |
| commit | 840b600525c7c6fd43395863c15ce955d9216b71 (patch) | |
| tree | 79e017fd6ced67650defddb3f10f40c6efc3d841 /thirdparty/fmt/doc/syntax.md | |
| parent | 5.7.25 (diff) | |
| parent | Cross-platform process metrics support (#887) (diff) | |
| download | zen-de/v5.7.25-hotpatch.tar.xz zen-de/v5.7.25-hotpatch.zip | |
Merge remote-tracking branch 'origin/main' into de/v5.7.25-hotpatchde/v5.7.25-hotpatch
Diffstat (limited to 'thirdparty/fmt/doc/syntax.md')
| -rw-r--r-- | thirdparty/fmt/doc/syntax.md | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/thirdparty/fmt/doc/syntax.md b/thirdparty/fmt/doc/syntax.md index 46d7d2fd2..ac5128233 100644 --- a/thirdparty/fmt/doc/syntax.md +++ b/thirdparty/fmt/doc/syntax.md @@ -251,7 +251,7 @@ The available integer presentation types are: <td><code>'b'</code></td> <td> Binary format. Outputs the number in base 2. Using the <code>'#'</code> - option with this type adds the prefix <code>"0b"</code> to the output value. + option with this type adds the prefix <code>"0b"</code> to the output value. </td> </tr> <tr> @@ -718,7 +718,7 @@ These modifiers are only supported for the `'H'`, `'I'`, `'M'`, `'S'`, `'U'`, Format specifications for range types have the following syntax: <pre><code class="language-json" ->range_format_spec ::= ["n"][range_type][range_underlying_spec]</code> +>range_format_spec ::= ["n"][range_type][":" range_underlying_spec]</code> </pre> The `'n'` option formats the range without the opening and closing brackets. @@ -761,14 +761,16 @@ fmt::print("{::}", std::vector{'h', 'e', 'l', 'l', 'o'}); // Output: [h, e, l, l, o] fmt::print("{::d}", std::vector{'h', 'e', 'l', 'l', 'o'}); // Output: [104, 101, 108, 108, 111] +fmt::print("{:n:f}", std::array{std::numbers::pi, std::numbers::e}); +// Output: 3.141593, 2.718282 ``` ## Format Examples This section contains examples of the format syntax and comparison with -the printf formatting. +the `printf` formatting. -In most of the cases the syntax is similar to the printf formatting, +In most of the cases the syntax is similar to the `printf` formatting, with the addition of the `{}` and with `:` used instead of `%`. For example, `"%03.2f"` can be translated to `"{:03.2f}"`. |