Here you can find the source of abbreviate(String longStr, int maxLength)
public static String abbreviate(String longStr, int maxLength)
//package com.java2s; //License from project: Open Source License public class Main { public static String abbreviate(String longStr, int maxLength) { String _longStr = getEmptyIfNull(longStr); return _longStr.length() > maxLength ? _longStr.substring(0, maxLength - 2) + ".." : _longStr; }/*from w ww.j a va 2s.c o m*/ public static String getEmptyIfNull(String str) { if (str == null) return ""; else return str; } }