This question already has an answer here:
- Split String on . as delimiter 8 answers
I try to split the String "1.1" to 2 new Strings:
String[] array = "1.1".split(".");
System.out.println(array[0]);
but I get a java.lang.ArrayIndexOutOfBoundsException
.
Why?
"1.1".split("\\.")
. – Omoro Apr 4 at 11:42"1.1".split(Pattern.quote("."))
for these cases, to improve readability. – WonderCsabo Apr 4 at 11:46