Home / Docs / Standard library / Prelude

join

Release v0.4.0Edition 0.2 and later

A function of the prelude, in scope in every module. Edition 0.2 and later.

una
pub join(parts: List[Text], separator: Text) -> Text

The parts joined, with separator between each two (spec/22 §2).

Parameters

Returns

Text: the parts joined, with separator between each two.

See also

split

Cost

Time O(total bytes) (ADR 0070), where:

Example

src/shop.unauna
module shop

--- The items of an order as one line.
pub main() -> Unit
  uses @console: Console[print]
=
  @console.print(join(["Café", "Crème", "Thé"], separator: ", "))

una run . prints:

Output
Café, Crème, Thé

Specification

Generated from the standard modules of una v0.4.0 (docs/std/listing.json, which is not part of the specification). The specification governs: spec/14 §1.