Suppose I have a text input like this: { "text": "apple earth yellow circle, peach jupiter blue, banana mars red" }
. I want to:
split the input using the "," separator
split each element from the list created above, into two subitems based on the last space character of the text, so the result would have
[{apple earth yellow, circle}, {peach jupiter, blue}, {banana mars, red}]
.
Step 1 is straightforward, but for step 2 I am not sure how to proceed. I guess it is some for loop buy I am not sure how to implement it.
Do you have any idea?
Thanks