Here you can find the source of subString(String str, int end)
public static String subString(String str, int end)
//package com.java2s; //License from project: Open Source License public class Main { public static String subString(String str, int end) { return subString(str, 0, end, "..."); }/* w w w . j a v a 2s . co m*/ public static String subString(String str, int start, int end, String suffix) { if (str == null) return str; try { return str.substring(start, end > str.length() ? str.length() : end) + (end < str.length() ? suffix : ""); } catch (Exception e) { return str; } } public static String subString(String str, int start, int end) { return subString(str, start, end, ""); } public static int length(String str) { if (str == null) return 0; return str.length(); } }