Ruby: Merging variables in to a string

前端 未结 7 930
[愿得一人]
[愿得一人] 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.

    0 讨论(0)
提交回复
热议问题