Commit 8b1bbbf1 authored by Tomas's avatar Tomas Committed by Facebook Github Bot

Added a precision example (#988)

Summary:
Because it wasn't clear for non-python developers. And this document is referenced in Spark AR documentation.
Pull Request resolved: https://github.com/facebook/folly/pull/988

Reviewed By: yfeldblum

Differential Revision: D13570180

Pulled By: Orvid

fbshipit-source-id: 2e1f787c5e1bb50a90c85a12e6801a79a3b46999
parent c533bbd1
......@@ -102,6 +102,10 @@ std::cout << format("{0:05d} decimal = {0:04x} hex", 42);
std::string s = format("The only answer is {}", 42).str();
std::cout << s;
// => "The only answer is 42"
// Decimal precision usage
std::cout << format("Only 2 decimals is {:.2f}", 23.34134534535);
// => "Only 2 decimals is 23.34"
```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment