Android String Shorten ellipsizeString(String string, int limit)

Here you can find the source of ellipsizeString(String string, int limit)

Description

ellipsize String

Declaration

public static String ellipsizeString(String string, int limit) 

Method Source Code

//package com.java2s;

public class Main {

    public static String ellipsizeString(String string, int limit) {
        String retValue = "";
        if (string != null) {
            if (string.length() > limit) {
                retValue = string.substring(0, limit) + "...";
            } else {
                retValue = string;/*from w w w  .ja  va2s .  c  om*/
            }
        }
        return retValue;
    }
}

Related

  1. truncateAt(String string, int length)
  2. curtail(String str, int size, String tail)
  3. truncateString(String resource, String startTag, String endTag)
  4. truncateAtMaxLength(String source, int maxLength, boolean addEllipsis)
  5. shortenString(String str, int length)
  6. ellipsize(final String text, final int length)