Here you can find the source of splitList(String source, char useChar)
public static List splitList(String source, char useChar)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static List splitList(String source, char useChar) { List list = new ArrayList(); String sub;// w ww . j a v a 2 s.co m if (source.charAt(0) == useChar) source = source.substring(1, source.length()); if (source.charAt(source.length() - 1) == useChar) source = source.substring(0, source.length() - 1); int start = 0; int end = source.indexOf(useChar); while (end > 0) { sub = source.substring(start, end); list.add(sub); start = end + 1; end = source.indexOf(useChar, start); } sub = source.substring(start, source.length()); list.add(sub); return list; } }