I am splitting the string using ^
char. The String which I am reading, is coming from some external source. This string contains some \n
characters.
The string may look like:
Hi hello^There\nhow are\nyou doing^9987678867abc^popup
when I am splitting like below, why the array length is coming as 2
instead of 4
:
String[] st = msg[0].split("^");
st.length //giving "2" instead of "4"
It look like, split is ignoring after \n
.
How can I fix it without replacing \n
to some other character.