Here you can find the source of substr(String what, int begin, int end)
public static String substr(String what, int begin, int end)
//package com.java2s; //License from project: Open Source License public class Main { public static String substr(String what, int begin, int end) { if (begin > end) { return ""; }// ww w. ja v a 2 s. c o m return what.substring(Math.max(0, begin), Math.min(end, what.length() - 1)); } }