Here you can find the source of subString(String str, int start, int end)
public static String subString(String str, int start, int end)
//package com.java2s; /*/* www.j av a 2 s . c om*/ * MoXie (SysTem128@GMail.Com) 2009-3-11 10:06:36 * * Copyright © 2008-2009 Zoeey.Org * Code license: GNU Lesser General Public License Version 3 * http://www.gnu.org/licenses/lgpl-3.0.txt */ public class Main { public static String subString(String str, int start, int end) { int strLen = str.length(); start = start > strLen ? strLen : start; // start = start > 0 ? start : 0; // if (end == -1) { end = strLen; } else { end = end > strLen ? strLen : end; } // return str.substring(start, end); } }