Here you can find the source of safeCut(String str, int length)
static String safeCut(String str, int length)
//package com.java2s; public class Main { static String safeCut(String str, int length) { if (str.length() > length) { return str.substring(0, length) + "..."; }// w w w . jav a 2 s . c o m return str; } }