Here you can find the source of substring(String baseString, int start, int end)
public static final String substring(String baseString, int start, int end)
//package com.java2s; /**//from w w w .j a va 2 s. c o m * Converts a line of text into an array of lower case words using a * BreakIterator.wordInstance(). * <p> * * This method is under the Jive Open Source Software License and was written * by Mark Imbriaco. * * @param text * a String of text to convert into an array of words * @return text broken up into an array of words. */ public class Main { public static final String substring(String baseString, int start, int end) { if (baseString == null) return null; else if (start >= baseString.length() || start < 0 || end < 0 || start > end) return null; else if (end >= baseString.length()) return baseString.substring(start); else { return baseString.substring(start, end); } } public static final String substring(String baseString, int start) { if (baseString == null) return null; else return substring(baseString, start, baseString.length()); } public static final int length(String baseString) { if (baseString == null) return 0; else return baseString.length(); } }