例:
String s = ":a:b:c:";
s.split(":");
// Output: [, a, b, c]
Run Code Online (Sandbox Code Playgroud)
来自Java Doc:
The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string.
为什么起始空字符串被认为是结束空字符串不在哪里?起始空字符串以":"结尾,结束空字符串以字符串结尾终止.所以两者都应该列出,如果不是的话?