我想使用“”拆分一个字符串,但是.split()给了我数组中不需要的空字符串。
.split()
我尝试了这个:
String[] arr = " hello world! b y e ".split(" ",0);
输出:
[“”,“”,“”,“”,“”,“你好”等等。
预期产量:
[“ hello”,“ world!”,“ b”,“ y”,“ e”]
我该如何实现?
java string split
java ×1
split ×1
string ×1