Android examples for java.lang:String Shorten
get Shorted string Content
import android.text.TextUtils; import java.util.regex.Pattern; public class Main{ public static String getShortedContent(String str) { if (str == null) { return ""; } else if (str.length() > 12) { String shorted = str.substring(0, 11) + "...."; return shorted; } else {//w w w . j a va 2 s .com return str; } } }