Here you can find the source of subString(String input, String startStr, String endStr)
public static String subString(String input, String startStr, String endStr)
//package com.java2s; /*/*w w w. j a va 2 s . c o m*/ * Copyright (c) 1996-2001 * vnxtele Corporation - VAS Center * @author ShadowMan - vnxtele Mobile Networks - VAS * @version 1.0, 25 January 2012 * All rights reserved. * * This software is distributed under vnxtele Open Source License Version 1.0 * ("Licence Agreement"). You shall use it and distribute only in accordance * with the terms of the License Agreement. * */ public class Main { public static String subString(String input, String startStr, String endStr) { try { int idxStart = input.indexOf(startStr); if (idxStart == -1) return ""; int idxEnd = input.indexOf(endStr, idxStart + 1 + startStr.length()); if (idxStart == -1 || idxEnd == -1) return ""; return input.substring(idxStart + startStr.length(), idxEnd).trim(); } catch (Exception ex) { } return ""; } }