Here you can find the source of splitString(String str, char delim)
static public String[] splitString(String str, char delim)
//package com.java2s; /*/*from www .j av a 2 s . c o m*/ * Copyright 2000-2013 Enonic AS * http://www.enonic.com/license */ import java.util.ArrayList; public class Main { static public String[] splitString(String str, char delim) { return splitString(str, String.valueOf(delim)); } static public String[] splitString(String str, String delim) { return splitString(str, delim, false); } static public String[] splitString(String str, String delim, boolean includeLastIfEmpty) { ArrayList<String> result = new ArrayList<String>(); if (str != null && str.length() > 0) { int idx = str.indexOf(delim); String substr; while (idx != -1) { substr = str.substring(0, idx); result.add(substr); str = str.substring(idx + 1); idx = str.indexOf(delim); } if (str.length() > 0 || includeLastIfEmpty) { result.add(str); } } return result.toArray(new String[0]); } }