Hi all, I have one array in this format: array1=[ ['a_1_1',1], ['a_1_2',2], ['a_1_3',2], ['a_2_1',1], ['b_1_1',1] ['c_1_1',1], ] How do I change it into this format? array2=[ ['a_1_1 a_1_2 a_1_3',1], ['a_2_1',1], ['b_1_1',1] ['c_1_1',1], ] element 0, 1, and 2 considered the same elements as they all contain 'a_1' Thanks,
on 2016-11-03 18:26
on 2016-11-07 14:35
The specification is a bit unclear. For instance, if the input were array1=[ ['a_1_1',1], ['a_2_1',1], ['b_1_1',1], ['a_1_2',2], ['c_1_1',1], ['a_1_3',2] ] should the output be the same as in your original case?
on 2016-11-17 16:05
No need to be the same orders as long as a_1_1, a_1_2, a_1_3 can be merged as a string divided by empty space.
on 2016-11-17 16:20
And how do you determin the single digit in the output? I.e. why should the resulting array be [['a_1_1 a_1_2 a_1_3',1],...] and not [['a_1_1 a_1_2 a_1_3',2],...] ?