Here you can find the source of addToken(String sequence, String delim, int[] markers, boolean includeDelim, List tokens)
private static void addToken(String sequence, String delim, int[] markers, boolean includeDelim, List tokens)
//package com.java2s; import java.util.List; public class Main { private static void addToken(String sequence, String delim, int[] markers, boolean includeDelim, List tokens) { markers[1] = sequence.indexOf(delim, markers[0]); if (markers[1] < 0) markers[1] = sequence.length(); else if (includeDelim) markers[1] += delim.length(); tokens.add(sequence.substring(markers[0], markers[1])); if (includeDelim) markers[0] = markers[1];/* w w w .j a v a 2 s .c o m*/ else markers[0] = markers[1] + delim.length(); } private static void addToken(String sequence, String start, String end, int[] markers, boolean includeDelim, List tokens) { markers[1] = sequence.indexOf(start, markers[0]); if (markers[1] < 0) markers[1] = sequence.length(); else { if (!includeDelim) markers[0] = markers[1] + start.length(); else markers[0] = markers[1]; markers[1] = sequence.indexOf(end, markers[0]); if (markers[1] < 0) markers[1] = sequence.length(); else if (includeDelim) markers[1] = markers[1] + end.length(); } tokens.add(sequence.substring(markers[0], markers[1])); if (includeDelim) markers[0] = markers[1]; else markers[0] = markers[1] + end.length(); } }