+ 1

I have following sveral arrays which each of them consists into a String.

x = ["t", "o", "d", "a", "y"] y = ["i", "s"] z = ["s", "u", "n", "d", "a", "y"] my output should be like following: x = [today] y = [is] Z = [sunday] in together: today is sunday How can i get expected array using ruby?

14th Nov 2018, 8:13 AM
Sadik Sikder
Sadik Sikder - avatar
1 Answer
+ 1
If you want to join together the letters into an array with just one string: x = [x.join] If you want to join each array into a string and join the strings into one string with the words separated by a space: ([x,y,z].map{|e| e.join}).join(' ')
14th Nov 2018, 11:40 AM
Leif
Leif - avatar