mirror of
https://github.com/fmtlib/fmt.git
synced 2026-06-15 08:26:13 +08:00
Improve docs
This commit is contained in:
parent
840a5b4190
commit
d04adde254
@ -134,7 +134,7 @@ presentation type:
|
|||||||
appropriate base prefix (`0b`/`0B`, `0`, or `0x`/`0X`). The case of the
|
appropriate base prefix (`0b`/`0B`, `0`, or `0x`/`0X`). The case of the
|
||||||
prefix follows the case of the type specifier — `0x` for `x`, `0X` for
|
prefix follows the case of the type specifier — `0x` for `x`, `0X` for
|
||||||
`X`, and so on.
|
`X`, and so on.
|
||||||
- For floating-point values, it forces the radix character to appear in the
|
- For floating-point values, it forces the decimal point to appear in the
|
||||||
output even if no fractional digits would otherwise be emitted, and
|
output even if no fractional digits would otherwise be emitted, and
|
||||||
prevents the `g`/`G` presentation types from removing trailing zeros from
|
prevents the `g`/`G` presentation types from removing trailing zeros from
|
||||||
the significand.
|
the significand.
|
||||||
@ -153,7 +153,7 @@ Zero padding:
|
|||||||
|
|
||||||
- applies only to numeric types;
|
- applies only to numeric types;
|
||||||
- has no effect on `inf` or `nan`;
|
- has no effect on `inf` or `nan`;
|
||||||
- is silently ignored when an explicit *align* is also present.
|
- is ignored when an explicit *align* is also present.
|
||||||
|
|
||||||
### Width
|
### Width
|
||||||
|
|
||||||
@ -187,9 +187,9 @@ supplied as a nested replacement field for runtime evaluation.
|
|||||||
|
|
||||||
| Type | Meaning of `.precision` |
|
| Type | Meaning of `.precision` |
|
||||||
|-------------------------------|-----------------------------------------------|
|
|-------------------------------|-----------------------------------------------|
|
||||||
| `e`, `E`, `f`, `F` | Digits emitted after the radix character. |
|
| `e`, `E`, `f`, `F` | Digits emitted after the decimal point. |
|
||||||
| `g`, `G` | Total number of significant digits. |
|
| `g`, `G` | Total number of significant digits. |
|
||||||
| `a`, `A` | Digits after the radix character in the hexadecimal significand. If omitted, just enough digits are emitted to round-trip the value exactly. |
|
| `a`, `A` | Digits after the decimal point in the hexadecimal significand. If omitted, just enough digits are emitted to round-trip the value exactly. |
|
||||||
| Strings (`s`, `?`, or default) | Upper bound on the number of code points copied from the value. |
|
| Strings (`s`, `?`, or default) | Upper bound on the number of code points copied from the value. |
|
||||||
|
|
||||||
A *precision* is not accepted for integer, character, boolean, or pointer
|
A *precision* is not accepted for integer, character, boolean, or pointer
|
||||||
@ -208,7 +208,7 @@ fmt::format("{:.{}f}", 3.14159, 4); // Result: "3.1416" -- precision from an ar
|
|||||||
The `L` flag selects locale-sensitive formatting for numeric types. The
|
The `L` flag selects locale-sensitive formatting for numeric types. The
|
||||||
formatter inspects the C++ locale supplied to the formatting function (or
|
formatter inspects the C++ locale supplied to the formatting function (or
|
||||||
the global locale, if none was passed) and inserts the locale's digit
|
the global locale, if none was passed) and inserts the locale's digit
|
||||||
grouping characters and — for floating-point values — its radix character.
|
grouping characters and — for floating-point values — its decimal point.
|
||||||
The flag has no effect on non-numeric types.
|
The flag has no effect on non-numeric types.
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user