Java tutorial
import java.util.StringTokenizer; public class Main { public static void main(String[] args) { int i = 0; String str = "one);two);three);four"; StringTokenizer st = new StringTokenizer(str, ");"); String temp[] = new String[st.countTokens()]; while (st.hasMoreTokens()) { temp[i] = st.nextToken(); System.out.println(temp[i]); i++; } } }