Here you can find the source of subString(String src, String begin, String end)
public static String subString(String src, String begin, String end)
//package com.java2s; //License from project: Apache License public class Main { public static String subString(String src, String begin, String end) { return subString(src, 0, begin, end); }//from w w w. j a va 2 s. c om public static String subString(String src, int offset, String begin, String end) { if (isEmpty(src) || offset >= src.length()) return ""; int b = offset; int e = src.length(); if (!isEmpty(begin)) { b = src.indexOf(begin, offset); if (b < 0) return ""; b += begin.length(); } if (!isEmpty(end) && b < e) { e = src.indexOf(end, b); if (e < 0) e = src.length(); } return src.substring(b, e); } public static boolean isEmpty(String str) { return str == null || (str.trim().length() == 0); } }