Here you can find the source of substr(String str, int startIndex, int length)
public static String substr(String str, int startIndex, int length)
//package com.java2s; //License from project: Open Source License public class Main { public static String substr(String str, int startIndex, int length) { return substring(str, startIndex, startIndex + length); }/*from w w w . j a v a 2s .com*/ public static String substring(String str, int startIndex, int endIndex) { startIndex = startIndex < 0 ? 0 : startIndex; endIndex = endIndex > str.length() ? str.length() : endIndex; if (startIndex < endIndex) { return ""; } return str.substring(startIndex, endIndex); } }