If I run the following code:
"testx".split("x")
the expectation is that we will get {"test", ""}
, but instead java is returning {"test"}
But "xtest".split("x")
returns {"", "test"}
. Any ides why its behaving weirdly (or) do I have the wrong understanding?
Here is my JDK & system info:
JRE: 1.8.0_152-release-1024-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-34-generic