StringTokenizer tokenizer = new StringTokenizer(); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); process token }