Here you can find the source of splitAt(String inputString, Character inputChar)
public static String[] splitAt(String inputString, Character inputChar)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static String[] splitAt(String inputString, Character inputChar) { ArrayList<String> stringList = new ArrayList<String>(); String tempString; // tempString is used to add each string into an array StringBuilder sb = new StringBuilder(); for (int i = 0; i < inputString.length(); i++) { if (inputString.charAt(i) != inputChar) { sb.append(inputString.charAt(i)); } // if else { tempString = sb.toString(); stringList.add(tempString); sb.setLength(0);//from w w w . j ava2 s .c om } // else } // for // After reaching the last character of the string, we need to do the // following tempString = sb.toString(); stringList.add(tempString); sb.setLength(0); String[] stockArr = new String[stringList.size()]; stockArr = stringList.toArray(stockArr); return stockArr; } }