Java tutorial
//package com.java2s; import java.util.StringTokenizer; public class Main { private static String[] parseCommandStr(String str) { StringTokenizer st = new StringTokenizer(str, "|"); String[] command_arr = new String[st.countTokens()]; int i = 0; while (st.hasMoreElements()) { command_arr[i] = (String) st.nextElement(); i++; } return command_arr; } }