Let say I want to split string by ,, e.g
Input string-
"hello world,,,hello country,,hello city"
Expected Output array-
["hello world,", "hello country", "hello city"]
If I use input.split(",,")
Result-
["hello world", ",hello country", "hello city"]
In the above result the extra comma becomes the part of second string, but I would like it to be the part of first string as shown in expected output.
so technically I want while splitting string like ",,," the first comma should be the part of first string rather than last comma being the part of second string. How can I achieve this it in most simple and idiomatic way.