I have been in a fight with an array which is similar to (original contains 5000+ elements):
[
"Some Section ⌄",
"b",
"c",
"d",
"e",
"Some Other section ⌄",
"b",
"c",
"d",
"x",
]
I want to produce an output that looks like:
[
{
"section": "Some Section",
"items":[
"b",
"c",
"d",
"e"
]
},
{
"section": "Some Other Section",
"items":[
"b",
"c",
"d",
"x"
]
},
]
So the "breaking point" or "grouping character" is the ⌄
symbol. I tried to capture the index into a new array and then loop from index to index -1 etc. Whatever I attempt, I fail, does anyone have a magic trick up their sleeve ? I can no longer see it properly :')