cut String - Android java.lang

Android examples for java.lang:String Shorten

Description

cut String

Demo Code

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;
    }

}

Related Tutorials