join

join collection of values into string


Parameters

join collection :literal :pathliteral :block

Attributes

with :char, :string use given separator
path join as path components
lines join with newlines as separator.
words join with spaces as separator

Returns

  • :string
  • or  :nothing

Examples

copy
arr: ["one" "two" "three"] print join arr ; onetwothree print join.with:"," arr ; one,two,three join 'arr ; arr: "onetwothree"

copy
print join ['H' 'e' 'l' 'l' 'o' '!'] ; Hello! print join @["1 + 2 = " 1+2] ; 1 + 2 = 3

copy
join.with:'-' ["Hello" "world"] ; => "Hello-world"

copy
join.words ["This" "is" "a" "sentence."] ; => "This is a sentence."

copy
; This example uses the universal new line character ; If you need to use carriage return for some reason, use join.with: "\\r\\n" instead. $> join.lines ["# Recipe", "", "1. Apple", "2. Banana"] => # Recipe 1. Apple 2. Banana

Related