Java tutorial
//package com.java2s; import java.util.*; public class Main { public static String[] strToArrayOfString(String str) { if (str == null) { return new String[0]; } StringTokenizer tmpst = new StringTokenizer(str, "|", false); int len = tmpst.countTokens(); String[] retl = new String[len]; for (int i = 0; i < len; i++) { retl[i] = tmpst.nextToken(); } return retl; } }