I have strings which look like this:
[item 1, item2, item3]
and my desired output is:
item 1
item2
item3
I wrote this code:
String text = "[item 1, item2, item3]";
String[] text_output = text.split(", |\\[|\\]");
for(String item:text_output)
fileOutStream.write(("\n"+item).getBytes());
and the output I get is correct, with the difference that in the output array the first element is an empty string. What am I doing wrong?