Here you can find the source of splitOnCharArray(String value, String splitOn)
public static String[] splitOnCharArray(String value, String splitOn)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static String[] splitOnCharArray(String value, String splitOn) { ArrayList<String> pointPairs = new ArrayList<String>(); //Creating HashMap for faster search operation int i;/*w ww . ja v a 2s . c o m*/ int prev = 0; for (i = 0; i < value.length(); i++) { if (splitOn.indexOf(value.charAt(i)) != -1) { pointPairs.add(value.substring(prev, i)); while (i < value.length() && splitOn.indexOf(value.charAt(i)) != -1) { i++; } prev = i; i--; } } boolean isLastElement = false; for (i = prev; i < value.length(); i++) { if (splitOn.indexOf(value.charAt(i)) == -1) { isLastElement = true; break; } } if (isLastElement) { pointPairs.add(value.substring(prev, value.length())); } return pointPairs.toArray(new String[0]); } }