> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://pdfmonkey.crisp.help/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Formatting numbers

PDFMonkey provides two filters that help with formatting numbers: `with_delimiter` and `format`.

# with_delimiter

| This filter is great for formatting money!

```
{{12345.67 | with_delimiter, delimiter: ' ', separator: ',' }}€
12 345,67€

£{{12345 | with_delimiter, precision: 2}}
£12,345.00
```

In most cases the last one should be enough as is gives a way to specify the decimal delimiter, the thousands separator and the precision (number of digits after the decimal delimiter).

```
{{12345678 | with_delimiter}}
12,345,678
```

```
{{'123456' | with_delimiter}}
123,456
```

```
{{12345678.05 | with_delimiter}}
12,345,678.05
```

```
{{12345678 | with_delimiter, delimiter: '.'}}
12.345.678
```

```
{{12345678 | with_delimiter, delimiter: ','}}
12,345,678
```

```
{{12345678 | with_delimiter, delimiter: ',', precision: 2}}
12,345,678.00
```

```
{{12345678.05 | with_delimiter, separator: ' '}}
12,345,678 05
```

```
{{12345678.05 | with_delimiter, delimiter: ' ', separator: ','}}
12 345 678,05
```

```
{{'123a' | with_delimiter}}
123a
```

# format

For more rare and advanced cases, you may need `format` as it provides ways to pad numbers, conditionally include decimals, etc.

```
{{5 | format: "%05d"}}
00005
```

```
{{5 | format: "%08.3f"}}
0005.000
```

```
{{5 | format: "%.2f"}}
5.00
```

```
{{5.1234 | format: "%.2f"}}
5.12
```

This filter is based on the Ruby format method. You can learn more about all the possibilities in the [dedicated documentation](https://ruby-doc.org/3.2.1/format_specifications_rdoc.html#label-Flags).