I want to split a string by a character sequence, not by a single character. I have this:
String m = "Alcides&|&ola&|&Alcides";
String[] split = m.split("&|&");
System.out.println(split[0] + split[1] + split[2]);
My goal is to have in split[0] -> Alcides
and in split[1] -> ola
and in split[2] -> Alcides
.
But instead the result of the System.out.println
is:
Alcides|ola|