import java.util.StringTokenizer; // This appears in Core Web Programming from Prentice // Hall Publishers, and may be freely used or adapted. // 1997 Marty Hall, http://www.apl.jhu.edu/~hall/java/ /** Prints the tokens resulting from treating the first * command-line argument as the string to be tokenized * and the second as the delimiter set. */ public class TokTest { public static void main(String[] args) { if (args.length == 2) { String input = args[0], delimiters = args[1]; StringTokenizer tok = new StringTokenizer(input, delimiters); while (tok.hasMoreTokens()) System.out.println(tok.nextToken()); } else System.out.println ("Usage: java TokTest string delimeters"); } }