mirror of
https://github.com/fmtlib/fmt.git
synced 2026-06-15 00:16:15 +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
|
||||
prefix follows the case of the type specifier — `0x` for `x`, `0X` for
|
||||
`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
|
||||
prevents the `g`/`G` presentation types from removing trailing zeros from
|
||||
the significand.
|
||||
@ -153,7 +153,7 @@ Zero padding:
|
||||
|
||||
- applies only to numeric types;
|
||||
- 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
|
||||
|
||||
@ -187,9 +187,9 @@ supplied as a nested replacement field for runtime evaluation.
|
||||
|
||||
| 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. |
|
||||
| `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. |
|
||||
|
||||
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
|
||||
formatter inspects the C++ locale supplied to the formatting function (or
|
||||
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.
|
||||
|
||||
```c++
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user