# map.join_to_text · Rell standard library · Chromia Docs (concept)

> pure function join_ to_ text([separator: text ], [prefix: text ], [postfix: text ], [limit: integer ?], [truncated: text ], [transform: ((K, V)) -> text ])

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/map/join_to_text/

FUNCTION

# map.join\_to\_text

```signature
pure function join_to_text([separator: text], [prefix: text], [postfix: text], [limit: integer?], [truncated: text], [transform: ((K, V)) -> text]): text
```

Generate a textual representation of this iterable.

An optional separator, prefix and postfix can be provided. One can also provide a `limit: integer?`.
If there are more elements in the result than `limit`, the elements whose indices exceed `limit`
are omitted, and the passed `truncated: text` is included instead.

Examples:

* `[1, 2, 3].join_to_text()` returns `'1, 2, 3'`.
* `[1, 2, 3].join_to_text('_')` returns `'1_2_3'`.
* `[1, 2, 3].join_to_text('*', '(', ')')` returns `'(1*2*3)'`.
* `list<T>().join_to_text('!', '(', ')')` returns `'()'` (where `T` is a valid type).
* `range(10).join_to_text('', '', '', 5)` returns `'01234...'`.
* `range(10).join_to_text('', '', '', 5, 'more')` returns `'01234more'`.

Where the function `even` is defined:

Rell

```
function even(x: integer): text {
   return if (x % 2 == 0) 'EVEN' else 'ODD';
}
```

Then:

* `range(10).join_to_text('->', '{', '}', 5, '...', even(*))` returns `{EVEN->ODD->EVEN->ODD->EVEN->...}`.

`transform` can also be given as a lambda:

* `[1, 2, 3].join_to_text(transform = x -> 'n' + x)` returns `'n1, n2, n3'`.
* `range(10).join_to_text('->', '{', '}', 5, '...', x -> if (x % 2 == 0) 'EVEN' else 'ODD')` returns
  `{EVEN->ODD->EVEN->ODD->EVEN->...}`.

**Parameters**

* **separator** — the separator between the elements, defaults to `', '`
* **prefix** — the prefix text, default empty
* **postfix** — the postfix text, default empty
* **limit** — The maximum number of elements to include in the result. If the number of elements exceeds `limit`, the value of the `truncated` argument is appended (after the last separator occurrence and before the postfix). Defaults to `null`, meaning no limit.
* **truncated** — the text to be appended if the number of elements is greater than `limit`, defaults to `'...'`
* **transform** — a transformation function to apply to each element before joining, defaults to `to_text()`

**Returns**

a textual representation of this iterable

Since 0.13.10

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