SplitScript reference / String / join

String.join

Function

String.join(values: [String], separator: String) -> String

Joins an array of strings with one separator between adjacent values.

Empty and single-element arrays add no separators. The final string is allocated once after measuring every value and separator.

Parameters

  • values: The strings to join in order.
  • separator: The string inserted between adjacent values.

Effects: allocates

Runtime behavior: available everywhere; synchronous

Examples

Format a route identifier

let route = String.join(["chapter", "room", "exit"], ".")