I want to produce an array that splits a string based on either a string of text within it that it called "stop" and I also want to split based on the presence of a new line (\n).
However, it doesn't seem to split based on the presence of a new line, how would I do this? So far I have:
String[] myArray = str.split("stop");
But I want to include splits are a new line, but I can't seem to do this through the methods I have tried.
The data returned is a string containing something such as the following:
data1stopdata2stopdata3\n
So I would want to put the strings data1 and data2 into the array, and then also data3 into the array without the additional line.