Here you can find the source of subStr(String src, int len)
public final static String subStr(String src, int len)
//package com.java2s; public class Main { public final static String subStr(String src, int len) { if (src.length() <= len) return src; return src.substring(0, len - 1); }//w w w .ja v a 2 s. c o m }