ruby 1.9 how to convert array to string without brackets

后端 未结 4 659
闹比i
闹比i 2021-02-13 17:03

My question is about how to convert array elements to string in ruby 1.9 without getting the brackets and quotation marks. I\'ve got an array (DB extract), from which I want to

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-13 17:50

    You can think of this as arrayToString()

    array = array * " "

    E.g.,

    myArray = ["One.","_1_?! Really?!","Yes!"]

    => "One.","_1_?! Really?!","Yes!"

    myArray = myArray * " "

    => "One. _1_?! Really?! Yes."

提交回复
热议问题