Here you can find the source of truncVal(String s)
public static String truncVal(String s)
//package com.java2s; //License from project: Apache License public class Main { public static String truncVal(String s) { if (s == null) { return ""; }// www . j av a 2 s . co m int len = Math.min(s.length(), 10); String postfix = ""; if (s.length() > len) { postfix = "..."; } return s.substring(0, len) + postfix; } }