github.com/rabbouni145/gg@v0.47.1/docs/content/en/functions/NumFmt.md (about)

     1  ---
     2  title: lang.NumFmt
     3  description: "Formats a number with a given precision using the requested `negative`, `decimal`, and `grouping` options. The `options` parameter is a string consisting of `<negative> <decimal> <grouping>`."
     4  godocref: ""
     5  workson: []
     6  date: 2017-02-01
     7  publishdate: 2017-02-01
     8  lastmod: 2017-08-21
     9  categories: [functions]
    10  keywords: [numbers]
    11  menu:
    12    docs:
    13      parent: "functions"
    14  toc: false
    15  signature: ["lang.NumFmt PRECISION NUMBER [OPTIONS]"]
    16  workson: []
    17  hugoversion:
    18  relatedfuncs: []
    19  deprecated: false
    20  draft: false
    21  aliases: []
    22  comments:
    23  ---
    24  
    25  The default options value is `- . ,`.
    26  
    27  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`.
    28  
    29  ```
    30  {{ lang.NumFmt 2 12345.6789 }} → 12,345.68
    31  {{ lang.NumFmt 2 12345.6789 "- , ." }} → 12.345,68
    32  {{ lang.NumFmt 0 -12345.6789 "- . ," }} → -12,346
    33  {{ lang.NumFmt 6 -12345.6789 "- ." }} → -12345.678900
    34  {{ -98765.4321 | lang.NumFmt 2 }} → -98,765.43
    35  ```