Here you can find the source of subString(String str, int len)
public static String subString(String str, int len)
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt public class Main { public static String subString(String str, int len) { if (len < 0) { return str; }/*from www. ja va2s .c om*/ if ("".equals(str) || str == null) { return null; } else if (str.length() <= len) { return str; } else { return str.substring(0, len); } } }