Ruby: Merging variables in to a string

前端 未结 7 951
[愿得一人]
[愿得一人] 2020-12-02 10:23

I\'m looking for a better way to merge variables into a string, in Ruby.

For example if the string is something like:

\"The animal action<

7条回答
  •  抹茶落季
    2020-12-02 10:55

    ["The", animal, action, "the", second_animal].join(" ")
    

    is another way to do it.

提交回复
热议问题