Here you can find the source of splitFast3(String data, char splitChar)
public static String[] splitFast3(String data, char splitChar)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static String[] splitFast3(String data, char splitChar) { if (data == null) { return new String[0]; }//from w ww . j av a 2s. c om List<String> result = new ArrayList<String>(); int last = 0; int dataLength = data.length(); for (int i = 0; i < dataLength; i++) { if (data.charAt(i) == splitChar) { result.add(data.substring(last, i)); last = i + 1; } } return result.toArray(new String[0]); } public static String substring(String src, String fromToken, String toToken) { int from = src.indexOf(fromToken); if (from == -1) return null; from += fromToken.length(); int to = src.indexOf(toToken, from); if (to == -1) { return src.substring(from); } return src.substring(from, to); } public static int indexOf(String nextLine, char c) { int length = nextLine.length(); for (int i = 0; i < length; i++) { if (c == nextLine.charAt(i)) return i; } return -1; } public static int indexOf(String nextLine, char[] chars) { int length = nextLine.length(); for (int i = 0; i < length; i++) { for (char c : chars) { if (c == nextLine.charAt(i)) return i; } } return -1; } }