String s = "32; Potatoe; Vegetables; 21.30; 12.20; 15 21 32 45;";
String[] splittedWords;
splittedWords = s.split(";");
You can use the method split to seperate words along delimiters. It will return a list of Strings.
If you want to parse the values in the string to an Integer you can use this:
for (String string : splittedWords)
{
if(string.matches("[^a-z \\.]+")==true)
{
int value = Integer.parseInt(string);
System.out.println(value);
}
}
the only integer in your samplestring is 32, though. Thats why this code will only output "32".