I am making a program where I receive a List of Integer from another method. I am looping through the list and saving the results to a String. What I want is then to convert that String to a String array. I'm doing it this way but it doesn't work. I do not know what I'm doing wrong!
for (Iterator<Integer> j=ocupada.iterator();j.hasNext();){
solucion += j.next().intValue()+".";
}
String array[]=solucion.split(".");
In this case it is the function
split()
must be used but with the "." escaped ie:the reason is that the dot is considered a metacharacter , check this answer:
Why can't I separate text with split?