我想采用多维数组:
m_array = [["S39.91", "S39.91"], ["B99.9"]]
并根据其分组将其转换为单个字符串:
String One = "S39.91, S39.91"
String Two = "B99.9"
答案 0 :(得分:5)
怎么样:
m_array.map { |strings| strings.join(', ') }
那会给你一个数组:
["S39.91, S39.91", "B99.9"]
然后您可以使用它来分配变量:
string_1, string_2 = ["S39.91, S39.91", "B99.9"]