How can I 'join' an array adding to the beginning of the resulting string the first character to join?

前端 未结 6 1045
感动是毒
感动是毒 2021-01-21 06:11

I am using Ruby on Rails 3 and I am trying join an array with the & character. I read the Ruby documentation about that.

My array is:

6条回答
  •  醉梦人生
    2021-01-21 06:34

    Join is meant to not prepend a string. Here's another option:

    "&#{["name1","name2"].join("&")}"
    

提交回复
热议问题