Android examples for java.lang:String Shorten
cut String
import java.util.Random; public class Main{ public static String cutString(String str, int length) { String result = str;/*from w w w .ja v a2 s.c om*/ if (str.length() > length) { result = str.substring(0, length) + "..."; } return result; } }