Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static String substring(StringBuilder st, int s, int e) { int len = st.length(); if (s > e) return ""; if (s >= len) return ""; if (len < e) e = len; return st.substring(s, e); } }