I'm fairly new to Java and I thought this worked the same as with other languages.
For a string:
String line = "3::Daniel::Louis||##2::Leon: the Professional::1994||6::Jean::Reno||7::Gary::Oldman||8::Natalie::Portman||##3::Scarface::1983||9::Al::Pacino||10::Michelle::Pfeiffer";
I want to split it at every ||##
.
But:
for(String s : line.split("||##")) {
System.out.println("|"+s+"|");
}
returns:
||
|3|
|:|
|:|
|D|
|a|
|n|
|i|
... etc.
I was expecting:
3::Daniel::Louis
Leon: the Professional
... etc.
What am I doing wrong?