Here you can find the source of substring(String string, String beginning, String end)
public static String substring(String string, String beginning, String end)
//package com.java2s; //License from project: Open Source License public class Main { public static String substring(String string, String beginning, String end) { if (!string.contains(beginning) || !string.contains(end) || string.indexOf(beginning) >= string.indexOf(end)) return null; else {/*from w w w. java 2 s . c o m*/ String after_beginning = string.substring(string.indexOf(beginning) + beginning.length()); return after_beginning.substring(0, after_beginning.indexOf(end)); } } }