diff options
author | Cameron Moore <moorereason@gmail.com> | 2018-10-02 09:41:48 -0500 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-10-02 17:41:48 +0300 |
commit | ce264b936ce9f589bd889e18762881cff8bc9cd0 (patch) | |
tree | 1a244eff8d90784f01ab0336e9fafcb8d0b018ce /docs/content/en/functions | |
parent | 91f49c0700dde13e16f42c745584a0bef60c6fe2 (diff) |
tpl: Add a delimiter parameter to lang.NumFmt
The original implementation of NumFmt did not take into account that the
options delimiter (a space) could be a valid option. Adding a delim
parameter seems like the simplest, safest, and most flexible way to
solve this oversight in a backwards-compatible way.
Fixes #5260
Diffstat (limited to 'docs/content/en/functions')
-rw-r--r-- | docs/content/en/functions/NumFmt.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/docs/content/en/functions/NumFmt.md b/docs/content/en/functions/NumFmt.md index 795eaaea8..1bc07abd5 100644 --- a/docs/content/en/functions/NumFmt.md +++ b/docs/content/en/functions/NumFmt.md @@ -12,7 +12,7 @@ menu: docs: parent: "functions" toc: false -signature: ["lang.NumFmt PRECISION NUMBER [OPTIONS]"] +signature: ["lang.NumFmt PRECISION NUMBER [OPTIONS [DELIMITER]]"] workson: [] hugoversion: relatedfuncs: [] @@ -22,7 +22,9 @@ aliases: [] comments: --- -The default options value is `- . ,`. +The default options value is `- . ,`. The default delimiter within the options +value is a space. If you need to use a space as one of the options, set a +custom delimiter. Numbers greater than or equal to 5 are rounded up. For example, if precision is set to `0`, `1.5` becomes `2`, and `1.4` becomes `1`. @@ -31,5 +33,6 @@ Numbers greater than or equal to 5 are rounded up. For example, if precision is {{ lang.NumFmt 2 12345.6789 "- , ." }} → 12.345,68 {{ lang.NumFmt 0 -12345.6789 "- . ," }} → -12,346 {{ lang.NumFmt 6 -12345.6789 "- ." }} → -12345.678900 +{{ lang.NumFmt 6 -12345.6789 "-|.| " "|" }} → -1 2345.678900 {{ -98765.4321 | lang.NumFmt 2 }} → -98,765.43 ``` |