将ruby数组转换为常规字符串

时间:2017-01-12 08:57:47

标签: ruby regex text-processing

我有一个像这样的数组

text_arr = ["hello","how","are","you"]

我希望将其转换为像这样的字符串

text = "hello how are you"

我如何用Ruby做到这一点?

1 个答案:

答案 0 :(得分:3)

试试这个

text = text_arr.join(' ')