Questo è un follow-up a this question.Comportamento di divisione stringa su stringa vuota e su stringa delimitatore singolo
La domanda è nella seconda riga in basso.
"".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"}
Vedi [SI-5096] (https://issues.scala-lang.org/browse/SI-5069) "Bug in split() quando delimitatori si verificano alla fine della stringa" – 4e6
Questo è il motivo per Google Guava ha creato com.google.common.base.Splitter – Schildmeijer