请看下面的代码 -
String s11 ="!country=India ";
String[] ss =s11.split("((?<=[!&|])|(?=[!&|]))");
System.out.println(ss.length);
for(String s :ss) {
System.out.println(s);
}
Run Code Online (Sandbox Code Playgroud)
在Windows上,它给出了
2
!
country=India
Run Code Online (Sandbox Code Playgroud)
而Ubuntu给出了它
3
!
country=India
Run Code Online (Sandbox Code Playgroud)
那为什么会这样?