I have a string (example below) that I would like to parse into an array
//just a stupid example
String s = "Mary Mark {John Brown} Honey lollipop Badger {Oh My God} {Such stupid}";
I'm interested in breaking that string to String[][] or ArrayList, so if i called:
String[][] x = transform(s);
x would contain something like this:
String[][] x = {{"Mary"}, {"Mark"}, {"John", "Brown"}, {"Honey"}, {"lollipop"}, {"Badger"}, {"Oh", "My", "God"}, {"Such", "stupid"}};
how do i do that?
EDIT: changed to 2d array
{"Such", "stupid"}one string?{"John", "Brown"}which is not surrounded by"so it doesn't look like one string, but inner array of string. So what is{"John", "Brown"}exactly, string or array of strings? Also your example lacks last}after{"Such", "stupid"}.