Đây là bản theo dõi this question.Hành vi phân chia chuỗi trên chuỗi trống và trên chuỗi phân cách đơn lẻ
Câu hỏi đặt ở dòng thứ hai bên dưới.
"".split("x"); //returns {""} // ok
"x".split("x"); //returns {} but shouldn't it return {""} because it's the string before "x" ?
"xa".split("x"); //returns {"", "a"} // see?, here "" is the first string returned
"ax".split("x"); //returns {"a"}
xem [SI-5096] (https://issues.scala-lang.org/browse/SI-5069) "Bug trong split() khi delimiters xảy ra ở cuối chuỗi" – 4e6
Đây là lý do tại sao Google Ổi đã tạo com.google.common.base.Splitter – Schildmeijer