Here you can find the source of substringBetween(String source, String strBegin, String strEnd)
public static String substringBetween(String source, String strBegin, String strEnd)
//package com.java2s; /* /*from w w w .j ava 2s . co m*/ * @(#)StringUtil.java 1.0 2004-10-11 * * Copyright 2005 UFIDA Software Co. Ltd. All rights reserved. * UFIDA PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { public static String substringBetween(String source, String strBegin, String strEnd) { if (null == source) return null; int index = source.indexOf(strBegin); int indexEnd = source.indexOf(strEnd); if (index < 0) index = 0 - strBegin.length(); if (indexEnd < 0) indexEnd = source.length(); return source.substring(index + strBegin.length(), indexEnd); } }