mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Add locale example
This commit is contained in:
parent
fd1cabe464
commit
0b2eb6501c
@ -399,13 +399,15 @@ Using type-specific formatting::
|
|||||||
fmt::print("{:%Y-%m-%d %H:%M:%S}", t);
|
fmt::print("{:%Y-%m-%d %H:%M:%S}", t);
|
||||||
// Prints: 2010-08-04 12:15:58
|
// Prints: 2010-08-04 12:15:58
|
||||||
|
|
||||||
|
Using the comma as a thousands separator::
|
||||||
|
|
||||||
|
#include <fmt/locale.h>
|
||||||
|
|
||||||
|
auto s = fmt::format(std::locale("en_US.UTF-8"), "{:n}", 1234567890);
|
||||||
|
// s == "1,234,567,890"
|
||||||
|
|
||||||
.. ifconfig:: False
|
.. ifconfig:: False
|
||||||
|
|
||||||
Using the comma as a thousands separator::
|
|
||||||
|
|
||||||
format("{:,}", 1234567890);
|
|
||||||
'1,234,567,890'
|
|
||||||
|
|
||||||
Nesting arguments and more complex examples::
|
Nesting arguments and more complex examples::
|
||||||
|
|
||||||
>>> for align, text in zip('<^>', ['left', 'center', 'right']):
|
>>> for align, text in zip('<^>', ['left', 'center', 'right']):
|
||||||
|
Loading…
Reference in New Issue
Block a user