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) -> TextThe parts joined, with separator between each two (spec/22 §2).
Parameters
parts: the texts to join, in orderseparator: the text between each two parts
Returns
Text: the parts joined, with separator between each two.
See also
Cost
Time O(total bytes) (ADR 0070), where:
- total bytes: the length of the result in UTF-8 bytes: the parts and the separators between them
Example
src/shop.una
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.