cut String to length and show ... - Android java.lang

Android examples for java.lang:String Shorten

Description

cut String to length and show ...

Demo Code

public class Main{

    public static String cutString(String value, int length) {
        if (value == null || value.length() <= 0) {
            value = "...";
        } else if (value.length() <= length) {
            ;//w w  w .  j av  a2  s. c om
        } else {
            value = value.substring(0, length) + "...";
        }
        return value;
    }

}

Related Tutorials