Ruby combining an array into one string

ruby

Solution

Use the `Array#join` method (the argument to `join` is what to insert between the strings - in this case a space):

@arr.join(" ")

Problem

In Ruby is there a way to combine all array elements into one string? Example Array: ``` @arr = ['<p>Hello World</p>', '<p>This is a test</p>'] ``` Example Output: ``` <p>Hello World</p><p>This is a test</p> ```

Original source

Related problems