Here is the syntax of the String split method:
public String[] split(String regex) public String[] split(String regex, int limit)
public class Main { public static void main(String[] args) { String sampleString = "A | B | C |"; String[] items = sampleString.split("\\|"); for (String item : items) { System.out.println(">" + item+"<"); }/* ww w.j a v a2 s . c o m*/ } }