For the complete documentation index, see llms.txt. This page is also available as Markdown.

Number

To format numbers, use the $number format function:

Variable Name: the name of your variable that will contain the value to be formatted. Format String: the text code that tells Documint how to would like to format the value

General

$number

Used for applying custom formatting to numbers.

Signature

{{$number value format_string [locale]}}

Arguments

Name
Description
Type
Required

value

Name of variable to be formatted

Number

format_string

Pattern for formatting variable. See guide below

String

locale

Specify which locale to use for formatting currencies. See list below

String

default=

Default value to display when value is blank. Default=''

StringNumber

Returns

Formatted number

Example #1 - Basic

Example #2 - With Default

Standard

Value
Format String
Result

10000

"0,0.0000"

10,000.0000

10000.23

"0,0"

10,000

10000.23

"+0,0"

+10,000

-10000

"0,0.0"

-10,000.0

10000.1234

'0.000'

10000.123

100.1234

"00000"

00100

1000.1234

"000000,0"

001,000

10

"000.00"

010.00

10000.1234

"0[.]00000"

10000.12340

-10000

"(0,0.0000)"

(10,000.0000)

-0.23

".00"

-.23

-0.23

"(.00)"

(.23)

0.23

"0.00000"

0.23000

0.23

"0.0[0000]"

0.23

1230974

"0.0a"

1.2m

1460

"0 a"

1 k

-104000

"0a"

-104k

1

"0o"

1st

100

"0o"

100th

Currency

Example:

Number

Format String

String

1000.234

'$0,0.00'

$1,000.23

1000.2

'0,0[.]00 $'

1,000.20 $

1001

'$ 0,0[.]00'

$ 1,001

-1000.234

'($0,0)'

($1,000)

-1000.234

'$0.00'

-$1000.23

1230974

'($ 0.00 a)'

$ 1.23 m

You can set the locale using the locale code as the third argument.

Example

Reference

Name

Code

Example

United States

[default]

$1,000.00

Bulgarian

bg

лв1 000,00

Chinese (Simplified)

chs

¥1,000.00

Czech

cs

Kč1 000,00

Danish (Denmark)

da-dk

DKK1.000,00

German (Switzerland)

de-ch

CHF1 000,00

German

de

€1 000,00

English (Australia)

en-au

$1,000.00

English (UK)

en-gb

£1,000.00

English (South Africa)

en-za

R1 000,00

Spanish (Spain)

es-es

€1.000,00

Spanish

es

$1.000,00

Estonian

et

€1 000,00

Finnish

fi

€1 000,00

French (Canada)

fr-ca

$1 000,00

French (Switzerland)

fr-ch

CHF1'000.00

French

fr

€1 000,00

Hungarian

hu

Ft1 000,00

Italian

it

€1.000,00

Japanese

ja

¥1,000.00

Latvian

lv

€1 000,00

Dutch (Belgium)

nl-be

€ 1 000,00

Dutch (Netherlands)

nl-nl

€ 1.000,00

Norwegian

no

kr1 000,00

Polish

pl

PLN1 000,00

Portuguese (Brazil)

pt-br

R$1.000,00

Portuguese

pt-pt

€1 000,00

Russian (Ukraine)

ru-ua

₴1 000,00

Russian

ru

руб.1 000,00

Slovak

sk

€1 000,00

Slovenian

sl

€1.000,00

Thai

th

฿1,000.00

Turkish

tr

₺1.000,00

Ukrainian (Ukraine)

uk-ua

₴1 000,00

Vietnam

vi

₫1.000,00

Create custom locales using the following syntax:

Example

Reference

Name

Code

Default Value

Currency Symbol

s

$

Thousands Separator

t

,

Decimal

d

.

Thousands Abbreviation

th

k

Millions Abbreviation

mi

m

Billions Abbreviation

bi

b

Trillions Abbreviation

tr

t

Percentage

Number

Format String

String

1

'0%'

100%

0.974878234

'0.000%'

97.488%

-0.43

'0 %'

-43 %

0.43

'(0.000 %)'

43.000 %

Duration

Number

Format String

String

25

'00:00:00'

0:00:25

238

'00:00:00'

0:03:58

63846

'00:00:00'

17:44:06

Source: numeral.js

Last updated

Was this helpful?