小编use*_*444的帖子

Java字符串拆分在Windows和Linux上提供不同的输出

请看下面的代码 -

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)

那为什么会这样?

java string split

11
推荐指数
1
解决办法
1030
查看次数

标签 统计

java ×1

split ×1

string ×1