Files
hugo/content/functions/NumFmt.md
T
Bjørn Erik Pedersen b9bdfd40a6 Prefix methods with a "."
Not optimal, but it at least indicates that they need a context (Page etc.) and cannot be called alone.
2017-07-16 15:32:31 +02:00

1.0 KiB

title, description, godocref, workson, date, publishdate, lastmod, categories, menu, toc, signature, workson, hugoversion, relatedfuncs, deprecated, draft, aliases, comments
title description godocref workson date publishdate lastmod categories menu toc signature workson hugoversion relatedfuncs deprecated draft aliases comments
lang.NumFmt Formats a number with a given precision using the requested `decimal`, `grouping`, and `negative` characters.
2017-02-01 2017-02-01 2017-02-01
functions
docs
parent
functions
false
lang.NumFmt <decimal> <grouping> <negative> <precision> <number>
false false

title: lang.NumFmt description: "Formats a number with a given precision using the requested decimal, grouping, and negative characters." godocref: "" workson: [] date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 categories: [functions] #tags: [numbers] menu: docs: parent: "functions" toc: false signature: ["lang.NumFmt "] workson: [] hugoversion: relatedfuncs: [] deprecated: false draft: false aliases: [] comments:

lang.NumFmt formats a number with a given precision using the requested decimal, grouping, and negative characters. The default options value is - . ,.

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.

{{ lang.NumFmt "," "." "-" 2 12345.6789 }} → 12.345,68
{{ lang.NumFmt "." "" "-" 6 -12345.6789 }} → -12345.678900
{{ lang.NumFmt "." "," "-" 0 -12345.6789 }} → -12,346
{{ -98765.4321 | lang.NumFmt "." "," "-" 2 }} → -98,765.43