Reputation: 185
I want to take a multidimensional array:
m_array = [["S39.91", "S39.91"], ["B99.9"]]
And convert it to individual strings based on its grouping:
String One = "S39.91, S39.91"
String Two = "B99.9"
Upvotes: 2
Views: 444
Reputation:
What about:
m_array.map { |strings| strings.join(', ') }
That will give you an array:
["S39.91, S39.91", "B99.9"]
Which you can then use to assign to variables:
string_1, string_2 = ["S39.91, S39.91", "B99.9"]
Upvotes: 5