Here you can find the source of substring(String src, String fromToken, String toToken)
public static String substring(String src, String fromToken, String toToken)
//package com.java2s; //License from project: Apache License public class Main { public static String substring(String src, String fromToken, String toToken) { int from = src.indexOf(fromToken); if (from == -1) return null; from += fromToken.length();/*from w w w . j a v a 2s . c o m*/ 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; } }