From bd5f903f28579d9547a4b1763c1a39d1fba5c241 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 18 Jan 2020 07:11:45 -0800 Subject: [PATCH] Add a locale example --- doc/api.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/api.rst b/doc/api.rst index 0834a874..4e370252 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -85,6 +85,19 @@ Compatibility .. doxygentypedef:: fmt::string_view .. doxygentypedef:: fmt::wstring_view +Locale +------ + +All formatting is locale-independent by default. Use the ``'n'`` format +specifier to insert the appropriate number separator characters from the +locale:: + + #include + #include + + std::locale::global(std::locale("en_US.UTF-8")); + auto s = fmt::format("{:n}", 1000000); // s == "1,000,000" + .. _format-api: Format API