I have the following:
String string = \"1-50 of 500+\";
String[] stringArray = string.split(\" \");
Printing out all the elements in this
Use \\s+ to split on spaces even if they are more.
String string = "1-50 of 500+";
String[] stringArray = string.split("\\s+");
for (String str : stringArray)
{
System.out.println(str);
}
Full example: http://ideone.com/CFVr6N
EDIT:
If you also want to split on tabs, change the regex to \\s+|\\t+ and it detects both spaces and tabs as well.