# text.format · Rell standard library · Chromia Docs (concept)

> pure function format(args: anything...): text Uses this text as a format string and returns the text obtained by substituting the specified
arguments. Supp

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/text/format/

FUNCTION

# text.format

```signature
pure function format(args: anything...): text
```

Uses this text as a format string and returns the text obtained by substituting the specified
arguments.

Supports many of the format specifiers found in other programming languages, including:

* `%s` for `text`
* `%d` for `integer`s and `big_integer`s in decimal (base 10) representation
* `%o` for `integer`s and `big_integer`s in octal (base 8) representation
* `%x` for `integer`s and `big_integer`s in hexadecimal (base 16) representation
* `%f` for `decimal` (supports precision, e.g. `%.2f` for two decimal places)
* `%b` for `boolean`s (output in lower-case, i.e. `true` and `false`)
* `%B` for `boolean`s (output in upper-case, i.e. `TRUE` and `FALSE`)

Examples:

* `'My integer is %d.'.format(123)` returns `'My integer is 123.'`.
* `'See you...%10s.'.format('later')` returns `'See you... later.'`.
* `'Earnings: daily=%f, weekly=%f, monthly=%f.'.format(312.45, 534.78, 2199.67)` returns
  `'Earnings: daily=312.450000, weekly=534.780000, monthly=2199.670000.'`.
* `''%d %o %x'.format(14, 14, 14)'` returns `'14 16 e'`.

If any format specifier is incompatible with the type of its corresponding argument, or if there are
more specifiers requiring substitution than there are arguments, all format specifiers are left
unsubstituted in the output text.

All format specifiers are also left unsubstituted in the output text when any argument is `null`,
except when it matches the specifier is `%s`, in which case the text `'null'` is substituted
(assuming the other arguments and specifiers are correctly matched).

If there are more arguments than format specifiers, the extra arguments are ignored, but matched
arguments are still substituted (assuming they match correctly).

**Parameters**

* **args** — Arguments referenced by the format specifiers in this format string. The number of arguments is variable and may be zero.

**Returns**

formatted text

Since 0.6.0

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/%5Broot%5D/text/format.html)Generated API reference, mirrored from the live docs
