我正在寻找一种用Ruby将变量合并成字符串的更好的方法。
例如,如果字符串类似于:
"The animal action the second_animal“
我有用于animal、action和second_animal的变量,将这些变量放入字符串的首选方法是什么?
发布于 2011-09-15 08:09:33
["The", animal, action, "the", second_animal].join(" ")是另一种方式。
https://stackoverflow.com/questions/554666
复制相似问题