I am trying to figure out how to split a string into groups. I do not think that the split(regex) method will be sufficient for it.
I have String complexStatement = "(this && that)||(these&&those)||(me&&you)"; , and I would like the array to look like this:
"(this && that)","(these&&those)","(me&&you)""
If I had "(5+3)*(2+5)+(9)" , I would like to have "(5 + 3)", "(2 + 5)", "(9)".
(bonus points, if you can somehow save connection information, for example *,+,|| )
Is this possible for arbitrary line input? I play with StringTokenizer, but I have not had time to deal with it yet.
source share